I have what I think is a simple Postgres authentication requirement, but I can't figure out the
pg_hba.conf incantation to make it work.
I have a database user (role) named
dbuser which is the owner of a password-protected database
adb. There is a corresponding Unix user named
dbuser. The Unix user
dbuser should be able to connect to
adb without a password, all other Unix users should be able to connect by using the
dbuser role and providing the database password. I.e.
sudo -u dbuser psql -U dbuser adb
should not require a database password, but
sudo -u any_other_user psql -U dbuser adb
should require the database password.
local adb dbuser peer
works for the first case, but fails for the second (psql: FATAL: Peer authentication failed for user "dbuser"). I understand why, but can't figure out the right rules to do what I want. Unix socket connections (local) only. Postgres 9.2 if it makes a difference.