In /var/lib/pgsql/9.1/data/pg_hba.conf
, I have the following:
# TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
But when I execute
su -c "psql -d postgres" - postgres
it asks me for a password. My expectation is that users should not be prompted for a password.
There were other settings in there for local and IPv6 connections which were not
trust
. I made them alltrust
and it works now. So it looks like psql doesn't connect via IPv4.The address of the record with the trust field in the pg_hba.conf file needs to be ::1/128, presumably because the PostgreSQL server running on your local machine is using an address in that range.