Postgresql pg_hba.conf changes are ignored or not loaded

pg-hba.confpostgresqlpostgresql-9.3Ubuntu

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.

Best Answer

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.