pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: robert rottermann <robert@redcor.ch>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: how to set permission, so I can run pg_dumd in a cron job
Date: Sat, 13 Mar 2021 08:23:39 -0800
Message-ID: <aa20ac61-d965-5f77-ca1e-6d4b32d071f5@aklaver.com> (raw)
In-Reply-To: <08762210-ad92-7b0d-a1bc-45301bd76582@redcor.ch>
References: <08762210-ad92-7b0d-a1bc-45301bd76582@redcor.ch>

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@aklaver.com





view thread (4+ messages)  latest in thread

Message-ID: <aa20ac61-d965-5f77-ca1e-6d4b32d071f5@aklaver.com>
Permalink:  ../aa20ac61-d965-5f77-ca1e-6d4b32d071f5@aklaver.com/
Also on:    postgresql.org/message-id/aa20ac61-d965-5f77-ca1e-6d4b32d071f5@aklaver.com

 · 

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: adrian.klaver@aklaver.com, robert@redcor.ch
  Subject: Re: how to set permission, so I can run pg_dumd in a cron job
  In-Reply-To: <aa20ac61-d965-5f77-ca1e-6d4b32d071f5@aklaver.com>
  References: <08762210-ad92-7b0d-a1bc-45301bd76582@redcor.ch> <aa20ac61-d965-5f77-ca1e-6d4b32d071f5@aklaver.com>

* 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