Re: Help with authentication on Debain/Ubuntu installation

Magnus Hagander <[email protected]>
Newsgroups gmane.comp.db.postgresql.general
Message-ID <CABUevEw3e97aG1Z8fhaFN9QpgdduE_yP3s+1huvLwkC6aWNAeg@mail.gmail.com>
On Thu, Nov 21, 2019 at 1:46 PM stan <[email protected]> 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).

//Magnus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.