4

Using Postgresql 9.3 on Ubuntu 14.04.4 LTS

I've been changing the /etc/postgresql/9.3/main/pg_hba.conf config file madly trying to make a change that will allow me to log in with any user remotely.

My current configuration looks like so:

host all postgres <remote-ip>/32 trust
asdf asdf asdf
1 1
1-1-1-1-

This is, of course, a completely bogus config file. However, when I run

sudo service postgresql restart
sudo service postgresql reload

Both commands succeed with status [ OK ] - there are no parse errors. I have also disabled all entries that start with local and yet I am still able to login as the postgres user.

Any attempts to log into the server remotely from the host using:

psql -c 'SELECT version()' -h pg -U postgres

Result in:

psql: FATAL:  password authentication failed for user "postgres"
FATAL:  password authentication failed for user "postgres"

I am clearly not trying to use password authentication.

EDIT:

Running SHOW hba_file; as the postgres user yeilds

                hba_file
--------------------------------------
 /etc/postgresql/9.3/main/pg_hba.conf
(1 row)

Edit 2:

Checking the logs shows that the parse errors were happening. I have cleaned out the bogus lines, leaving

host all postgres <remote-ip>/32 trust

I am still getting a password prompt for some reason. There is nothing in the log after a failed login.

2
  • can you check logs ? after you run the command 'reload'
    – Sahap Asci
    Jul 11, 2016 at 13:34
  • @SahapAsci Question modified to reflect my findings.
    – subdavis
    Jul 11, 2016 at 13:44

2 Answers 2

4

Figured it out. This was a long shot, but it may help someone who has exhausted the normal avenues or is not used to postgres.

The server I was working on had another instance running through puppet, and so the config I was modifying was not for the instance I was connecting to.

run find / -name 'postgresql.conf' to see if there are any other locations where you might have a postgres instance.

0

Quite simply, the message is there plain to see:

psql: FATAL: password authentication failed for user "posgres"

Typo!

1
  • A typo while I was re-gathering output to paste here. Exact same problem when I correct this typo. Note that I can get the password-authentication error for any arbitrary user.
    – subdavis
    Jul 11, 2016 at 13:23

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.