pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: robert rottermann <robert@redcor.ch>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: how to set permission, so I can run pg_dumd in a cron job
Date: Sat, 13 Mar 2021 17:16:17 +0100
Message-ID: <08762210-ad92-7b0d-a1bc-45301bd76582@redcor.ch> (raw)

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






view thread (4+ messages)  latest in thread

Message-ID: <08762210-ad92-7b0d-a1bc-45301bd76582@redcor.ch>
Permalink:  ../08762210-ad92-7b0d-a1bc-45301bd76582@redcor.ch/
Also on:    postgresql.org/message-id/08762210-ad92-7b0d-a1bc-45301bd76582@redcor.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: robert@redcor.ch
  Subject: Re: how to set permission, so I can run pg_dumd in a cron job
  In-Reply-To: <08762210-ad92-7b0d-a1bc-45301bd76582@redcor.ch>
  References: <08762210-ad92-7b0d-a1bc-45301bd76582@redcor.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox