| From: | "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at> |
|---|---|
| To: | pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Peer authentication failed ??? |
| Date: | 2023-10-03 13:37:36 |
| Message-ID: | 20231003133736.zqxkqrbnmp44kpwg@hjp.at |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 2023-10-03 05:55:51 -0400, Amn Ojee Uw wrote:
> psql -U my_group_worker -d my_group_db
>
> psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432"
> failed: FATAL: Peer authentication failed for user "my_group_worker"
>
> *** What am I doing wrong?
PostgreSQL uses the first matching rule from pg_hba.conf. Presumably
(because that's the default on Debian/Ubuntu) you have it set up to use
peer authentication on the unix socket and password authentication
(scram or md5) on everything else.
You are connecting via the Unix socket (/var/run/postgresql/.s.PGSQL.5432),
so the server will attempt peer authentication and nothing else. To get
it to attempt password authentication connect via a tcp socket:
psql -U my_group_worker -h localhost -d my_group_db
(More conveniently set up ident authentication for your users, then you
don't need a password.)
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stephen Frost | 2023-10-03 13:39:36 | Re: pgBackRest for a 50 TB database |
| Previous Message | Ron | 2023-10-03 13:35:54 | Re: specifying multiple options in URI psql behaviour? |