2

I'm running postgres 9.4 on Ubuntu server 14 which is running on virtualbox. After a reboot no remote connections would work to postgres.

I have other services on server that still take remote connections (Rstudio server, Shiny server, SSH) and that machine can still connect to the internet, and to samba shares.

Here's my pg_hba.conf

    local   all             postgres                                peer
    host    all           scraper         localhost             trust
    local   all             all                                     peer
    host    all             all             127.0.0.1/32            md5
    host    all             all             ::1/128                 md5
    hostssl all             all             0.0.0.0/0               md5

In trying to connect with pgadmin from another machine, I get this message

An error has occurred:

03:23:06 PM: Error: Error connecting to the server.
FATAL: password authentication failed for user "postgres"

It fails if I use R, psql, or windows odbc connections so it doesn't appear to have anything to do with pgadmin

If I ssh in then I can run psql locally...

If I run \du I find that all users show Password valid until infinity

EDIT

I forgot to say that I am indeed using the correct password. I can be sure I'm using the right password because I when I was in psql I reset the password of the users in question using ALTER USER user WITH PASSWORD 'MYPASSWORD';

3
  • 1
    "password authentication failed" means you are supplying the wrong (or no) password. It has nothing to do with pg_hba.conf
    – user1822
    Dec 23, 2015 at 21:09
  • @a_horse_with_no_name I forgot to specify that I am indeed using the right password. I'll add that to the post. Dec 23, 2015 at 21:44
  • Are you using an SSL connection? What do you see in the DB logs? Dec 23, 2015 at 22:21

1 Answer 1

1

With your edit, you are probably running something like this, which will default to the user postgres:

psql -h 123.123.123 -d mydb

when you should be using the user flag:

psql -h 123.123.123 -d mydb -U whoever

you will be prompted for the password for user whoever.

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.