In PostgreSQL, I have the following configuration in pg_hba.conf
:
local all sec_eng scram-sha-256
host all sec_eng scram-sha-256
hostssl all app_server 192.168.1.0/32 scram-sha-256 clientcert=verify-full
There are no other configuration lines.
When I try to connect to PostgreSQL using sudo psql -U sec_eng
, the client authenticates me as a peer
, and does not prompt me for any password, and therefore the authentication fails.
If I try sudo psql -U sec_eng -h localhost
I am authenticated as Ident
, am not prompted for a password, and therefore the authentication fails.
What am I doing wrong here? How can I connect to PostgreSQL through a Unix Socket, using my username and a password?