Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@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.klaver@xxxxxxxxxxx





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux