1

I have these settings in my pg_hba.conf for a PostgreSQL-12.6 installation

# "local" is for Unix domain socket connections only
local   all             all                                     md5
local   all             postgres                                trust   # ident
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust   # md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust

I execpt local all postgres trust shoudl allow me to log in locally to psql without being queuried for a password as the postgres unix user.

However:

postgres@my-vm:/opt/db/postgres/bin> psql
Password for user postgres:

there is no existing psql password for the postgres user yet

1 Answer 1

4
local  all  all       md5  
local  all  postgres  trust   # ident  

Remember that the entries in pg_hba are processed in the order they given.

"local all postgres trust" ... should allow me to log in ... without ... password

And it would, if it appeared before the line that forced every local connection to use md5 authentication!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.