My Postgres installation won't allow me to connect remotely. I set the listen_addresses field in the postgresql.conf to '*' and added the line

host    all             all                  md5

to pg_hba.conf, restarted the database and tried

psql dbname uname -h 

I always get

Password authentication failed for user "uname"

(also when just setting

host    all             all                  md5

in hba or testing from a remote host).

I can't find any more configurations or suggestions to fix this. I'm running PostgreSQL 9.4 on Ubuntu 15.04 (installed from the repository). Has anyone a suggestion on what to try next? Or am I missing something?

  • did you try to connect to this remote database using pgadmin May 17, 2016 at 13:30
  • 1
    Wrong password? Not connecting to the database you think you are? May 17, 2016 at 14:21
  • @haceneabdessamed pgadmin gives me the same error: Password authentication failed for user "uname" May 17, 2016 at 14:22
  • @CraigRinger I can connect locally with the database with the same user and password (using pgsql dbname uname on the houst where postgres runs), I have the according rule in pg_hba.conf local all all md5 May 17, 2016 at 14:23
  • Does psql ask for the password on the terminal or do you get the error message without any interaction? May 17, 2016 at 17:59

1 Answer 1


Okay ... Upon installation of postgres another service was using the port 5432 so postgres took 5434. I didn't notice. Works now

  • Probably a previous Postgres instance had already taken 5432 (and another the 5433) port. May 18, 2016 at 10:03
  • Yeah, some docker container exposing to this port, running another postgres instance. I just would have never assumed that it changes the standard port upon installation. I thought it would rather fail on startup! I know it is documented, but well ... May 18, 2016 at 10:25

Your Answer

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

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