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

thanks

robert



Reply via email to