When i try to login from command line like this
psql -h dbserver -U testuser test
then i get this error
psql: FATAL: Ident authentication failed for user "testuser"
This is my
nano -w /var/lib/pgsql/data/pg_hba.conf
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections:
host all all 127.0.0.1/32 password
# IPv6 local connections:
host all all ::1/128 ident
host all all 192.168.0.1/24 password
You can’t specify a non-default user with
-Uinpsqlwhen usingidentauthentication. You won’t be runningpsqlas that user, so auth will fail.You must either use
sudo -u testuser psql testor changepg_hba.confso that authentication (at least fortestuseron the dbtest) usesmd5password authentication, and set a password fortestuserwithALTER USER ... PASSWORDif they don’t have one already.