Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

In /var/lib/pgsql/9.1/data/pg_hba.conf, I have the following:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all               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.

share|improve this question
If you don't specify a host through -h/--host then psql will (try to) connect through Unix-domain socket. Which is type local in the pg_hba.conf. –  Milen A. Radev May 19 '12 at 20:29
Thanks for the tip. –  Steve Taylor May 20 '12 at 9:13

1 Answer 1

There were other settings in there for local and IPv6 connections which were not trust. I made them all trust and it works now. So it looks like psql doesn't connect via IPv4.

share|improve this answer
Or if there are rules and localhost rules, then it might not have been using the one you expected. –  Stephen Ostermiller Nov 12 '13 at 20:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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