Score:1

pg_hba.conf - psql local login without password

de flag

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

Score:4
cn flag
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!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.