snippetsqlMinor
How do I enable md5 authentication for only one user?
Viewed 0 times
enableusermd5authenticationoneforhowonly
Problem
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
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?
local all all ident
local all scale md5but 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 identYou'll have to reload the conf
SELECT pg_reload_conf();Or, using something like
service postresql reloadCode Snippets
local all scale md5
local all all identSELECT pg_reload_conf();service postresql reloadContext
StackExchange Database Administrators Q#198753, answer score: 3
Revisions (0)
No revisions yet.