pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: stan <stanb@panix.com>
To: Magnus Hagander <magnus@hagander.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Help with authentication on Debain/Ubuntu installation
Date: Thu, 21 Nov 2019 09:35:39 -0500
Message-ID: <20191121143539.GA18839@panix.com> (raw)
In-Reply-To: <20191121141502.GA14731@panix.com>
References: <20191121124517.GA3320@panix.com>
	<CABUevEw3e97aG1Z8fhaFN9QpgdduE_yP3s+1huvLwkC6aWNAeg@mail.gmail.com>
	<20191121141502.GA14731@panix.com>


On Thu, Nov 21, 2019 at 09:15:02AM -0500, stan wrote:
> On Thu, Nov 21, 2019 at 02:05:09PM +0100, Magnus Hagander wrote:
> > On Thu, Nov 21, 2019 at 1:46 PM stan <stanb@panix.com> wrote:
> > 
> > > I am trying to set up to do some work with pg_dump, and I would like to be
> > > able to connect from my normal user to do this. This is on a Ubunt 18.04
> > > installation. I have added the follwing to pg_hba.conf:
> > >
> > > host    all             all             0.0.0.0/0               md5
> > > hostssl all             all             0.0.0.0/0               md5
> > >
> > > But when I try to login like this:
> > >
> > > psql stan postgres -W
> > >
> > > I get the following error, and yes, I set postgres'es password to something
> > > I know:
> > >
> > > tan@stantest:~$ psql stan postgres -W
> > > Password:
> > > psql: error: could not connect to server: FATAL:  Peer authentication
> > > failed for user "postgres"
> > > stan@stantest:~$
> > >
> > > What am I doing wrong?
> > >
> > >
> > By default, Debian has a row in pg_hba.conf that enforces peer specifically
> > for the postgres superuser when connecting over unix sockets (which is a
> > very good thing from a security perspective). You will have to find that
> > row further up in the file and comment it out (since the first row that
> > matches will be used).
> 
> Thanks, found it, I believe:
> 
> local   all             postgres 
> 
> Good to know first match wins, that is different than some other systems I
> am used to.

OK, there appears to be a bit more than I thought to this. Here is the line I
believe is causing me issues:

# Database administrative login by Unix domain socket
local   all             postgres                                peer

There is a comment saying that removing this is a bad idea, so ...

If the 1st rule matches, I am thinking this will override any rule I put in
after such as:

local all postgres md5

Is my understanding of this correct?


-- 
"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: <20191121143539.GA18839@panix.com>
Permalink:  ../20191121143539.GA18839@panix.com/
Also on:    postgresql.org/message-id/20191121143539.GA18839@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, magnus@hagander.net
  Subject: Re: Help with authentication on Debain/Ubuntu installation
  In-Reply-To: <20191121143539.GA18839@panix.com>
  References: <20191121124517.GA3320@panix.com> <CABUevEw3e97aG1Z8fhaFN9QpgdduE_yP3s+1huvLwkC6aWNAeg@mail.gmail.com> <20191121141502.GA14731@panix.com> <20191121143539.GA18839@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