How do I enable md5 authentication for only one user?
-
25-12-2020 - |
Question
I just installed Postgres 9.2 on CentOS 7. I want to keep peer authentication for all my users except one, which I would like to be able to access via "psql" through any user's account. I tried editing my /var/lib/pgsql/data/pg_hba.conf to be this
local all all ident
local all scale md5
but I'm still unable to login with the user "scale" unless I'm in that user's account. What do I need to do to set up md5 authentication for this one user only?
Solution
pg_hba.conf
looks only for the first match. Try switching the order..
local all scale md5
local all all ident
You'll have to reload the conf
SELECT pg_reload_conf();
Or, using something like
service postresql reload
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange