pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: stan <stanb@panix.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Help with authentication on Debain/Ubuntu installation
Date: Thu, 21 Nov 2019 16:52:26 -0500
Message-ID: <20191121215226.GA11603@panix.com> (raw)
In-Reply-To: <fe19e4f2-6549-ccdf-f3b4-83538711eeb0@aklaver.com>
References: <20191121124517.GA3320@panix.com>
	<CABUevEw3e97aG1Z8fhaFN9QpgdduE_yP3s+1huvLwkC6aWNAeg@mail.gmail.com>
	<20191121141502.GA14731@panix.com>
	<20191121143539.GA18839@panix.com>
	<ccd6af85-ae12-6e8e-82bb-f8ed6a46dd59@aklaver.com>
	<20191121161247.GE21704@panix.com>
	<a300b005-e176-2fb4-59bd-65c12acec8d9@aklaver.com>
	<20191121190927.GA21941@panix.com>
	<fe19e4f2-6549-ccdf-f3b4-83538711eeb0@aklaver.com>


On Thu, Nov 21, 2019 at 12:14:16PM -0800, Adrian Klaver wrote:
> On 11/21/19 11:09 AM, stan wrote:
> > 
> 
> > > It would help if you could spell out what you want to achieve, as I am sure
> > > it has been done before by multiple people on this list.
> > > 
> > 
> > Can do.
> > 
> > At the moment, I have 2 instances one production and one sandbox. I want to
> > be  able to run pg_dump -d "production", take the resultant file to the
> > sandbox and recreate a duplicate instance to do testing against. I would
> > prefer that this not involve changing UNIX users to the postgres user, just
> > to do this.
> 
> You don't. Seems to be my day to go through this:):
> 
> 1) There are the Postgres database users, postgres, stan for instance.

Right, I knew that.
> 
> 2) There are the system users, postgres, stan for instance.

Same.
> 
> 3) Even though they have the same username they are not the same user.
Yes.
> 
> 4) When you run pg_dump/pg_restore -U points to the database user not the
> system user. So any user can run pg_dump -d some_db -U postgres or the
> pg_restore version. If pg_hba.conf requires a password then they will need
> to know that, though it also possible to use .pgpass or env variables to
> work around that.

Understodd.
> 
> 5) Now in your case you have peer auth(first in the list) for local socket
> connections which means a user can only connect on the local socket as the
> db postgres user if they are also the os postgres user.
> You can work around that by having other users connect to the database using
> a -h(host) connection that requires a password.

So, to implement it this way. I would

* set teh postgres database user password to one I know.
* run tasks that need posgres superuser access with -h
<external_ip_address> -U postgress -W

* enter the password.

Correct?

I should  have thought of this technique, I have used it in the past when I
had issues with pg_hba.conf file. Something abou IPV6 entries, or lack of
them ?

Thanks for the help.

-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
						-- Benjamin Franklin





view thread (10+ messages)  latest in thread

Message-ID: <20191121215226.GA11603@panix.com>
Permalink:  ../20191121215226.GA11603@panix.com/
Also on:    postgresql.org/message-id/20191121215226.GA11603@panix.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: stanb@panix.com, adrian.klaver@aklaver.com
  Subject: Re: Help with authentication on Debain/Ubuntu installation
  In-Reply-To: <20191121215226.GA11603@panix.com>
  References: <20191121124517.GA3320@panix.com> <CABUevEw3e97aG1Z8fhaFN9QpgdduE_yP3s+1huvLwkC6aWNAeg@mail.gmail.com> <20191121141502.GA14731@panix.com> <20191121143539.GA18839@panix.com> <ccd6af85-ae12-6e8e-82bb-f8ed6a46dd59@aklaver.com> <20191121161247.GE21704@panix.com> <a300b005-e176-2fb4-59bd-65c12acec8d9@aklaver.com> <20191121190927.GA21941@panix.com> <fe19e4f2-6549-ccdf-f3b4-83538711eeb0@aklaver.com> <20191121215226.GA11603@panix.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