Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

this my configuration:


listen_addresses = 'localhost'


local all postgres md5
local all appuser trust
local all devuser trust
local all all peer

i'm connecting in local using the C-Library libpq. My connection string is:

host=localhost user=appuser dbname=mydbname port='5432'

However, unless I have a .pgpass file in the home of my developer user (devuser), (the one who launches the application that is linked with libpq), my executable cannot connect, I receive the error fe_sendauth : no password supplied

As I said, if the .pgpass file is here, then it connects ok.

What I don't understand: I configured local all appuser trust. Why do I need a .pgpass file all the same?

(It's not a serious problem in itself, because later on for security measure, it will no longer be at trust, but md5, so I'll have the .pgpass file anyway. But I'd like to know)

share|improve this question
up vote 4 down vote accepted

I can see how one might think listen_addresses = 'localhost' is somehow related to the authentication method local. But it is not. I quote the manual on listen_addresses:

listen_addresses (string)

Specifies the TCP/IP address(es) on which the server is to listen for connections from client applications.

And the chapter The pg_hba.conf File in the manual:


This record matches connection attempts using Unix-domain sockets. Without a record of this type, Unix-domain socket connections are disallowed.

Bold emphasis mine.

For connections via localhost (TCP/IP, local loopback) you actually need an entry for the authentication method host in your pg_hba.conf file (not for local).

share|improve this answer

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.