Right now my Postgres' pg_hba.conf file has the following lines:

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all               md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
#Should allow connection without password
host    all all   trust
host    all all ::0/0   trust

(I know that this is insecure. I'm just testing, and once it is successful, I'll keep it only specific users & databases)

My understanding was that trust should allow a user to connect without a password.

But when I do psql -U postgres -d postgres -h -w, I get the error message: psql: fe_sendauth: no password supplied

What do I need to do to allow users to connect without a password?

  • Did you reload the configuration after changing the file?
    – user1822
    Commented Apr 27, 2018 at 9:43
  • Yes, I did that. I'm sure that it is loaded, because I had made a mistake in the file earlier, and postgres refused to load till I corrected it. Commented Apr 27, 2018 at 9:44
  • 1
    Is there any line before those that you have shown us?
    – user1822
    Commented Apr 27, 2018 at 9:48
  • @a_horse_with_no_name; I've updated the question Commented Apr 27, 2018 at 9:59

1 Answer 1


When pg_hba.conf is checked for an authentication request, the first match determines the rule.

Quote from the manual

The first record with a matching connection type, client address, requested database, and user name is used to perform authentication. There is no “fall-through” or “backup”: if one record is chosen and the authentication fails, subsequent records are not considered

(Emphasis mine)

In your case the lines:

host    all             all               md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

are matched before the trust lines you have added, therefor Postgres requires a password. If you want to disable password authentication completely you have to disable the md5 authentication, e.g. by commenting those lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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