Re: how to set permission, so I can run pg_dumd in a cron job

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: robert rottermann <robert(at)redcor(dot)ch>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: how to set permission, so I can run pg_dumd in a cron job
Date: 2021-03-13 16:23:39
Message-ID: aa20ac61-d965-5f77-ca1e-6d4b32d071f5@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/13/21 8:16 AM, robert rottermann wrote:
> Hi Friends
>
> I would like to have a cronjob creating a dump of a db.
>
> I am on a ubuntu 18 lts, potgres v10.
>
> I have a user robert with superuser db permission.
>
> a database "mydb" of which I would like to to a nightly dump.
>
>
> I tried to set thing in hba_conf like this:
>
> # Database administrative login by Unix domain socket
> local   all             postgres peer
>
> # TYPE  DATABASE        USER            ADDRESS METHOD
>
> # "local" is for Unix domain socket connections only
> local   all             all trust
> # IPv4 local connections:
> host    all             all             127.0.0.1/32 trust
>
> and I create a /root/.pgpass file with this content
>
>
> hostname:port:database:username:password
> localhost:5432:mydb:robert:
>
>
>
> but still I get:
>
> root(at)elfero:~# pg_dump  -U robert -d mydb > dumps/mydb.sql
> pg_dump: [archiver (db)] connection to database "mydb" failed: FATAL:
> Peer authentication failed for user "robert"
>
>
> can you please give me a hand

1) Did you have the server reload the conf files after making the changes?

2) Is there an entry for something like:

local all all peer

before the lines you show above?

>
> thanks
>
> robert
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message robert rottermann 2021-03-13 17:25:36 Re: how to set permission, so I can run pg_dumd in a cron job
Previous Message Julien Rouhaud 2021-03-13 16:18:08 Re: How to recover data from 9.3 data directory