blog/content/post/psql-peer-auth-failed.md
2023-01-04 08:56:14 +05:30

1.5 KiB

title date lastmod draft keywords description tags categories author comment toc autoCollapseToc postMetaInFooter hiddenFromHomePage contentCopyright reward mathjax mathjaxEnableSingleDollar mathjaxEnableAutoNumber hideHeaderAndFooter flowchartDiagrams sequenceDiagrams
psql: FATAL: Peer authentication failed for user 2023-01-04T08:47:34+05:30 2023-01-04T08:47:34+05:30 false
postgresql
database postgres
linux
false false false true false false false false false false false
enable options
false
enable options
false

The order of rules in pg_hba.conf matters.

Trying to connect to postgresql database with a standard user fails with psql: FATAL: Peer authentication failed fr user "user1".

The second line of pg_hba.conf makes your connection attempt fail:

local   all     all     peer

The order of rules matter. If the first one that matches the access method, username, database name and source IP range fails, there will be no second attempt. So either remove this line, your place your rule above this one.