1

I'm using PostgreSQL 9.1 on an Ubuntu 12.04 server. The database instance seems to run fine in general and when I try and connect from pgAdmin III via localhost on the server machine itself, there is no problem.

Whenever I try to use the LAN address 192.168.1.16 from the server, I get the error "Access to database denied."

From what I gather, the common culprit in these sorts of situations seems to be the configuration described in the pg_hba.conf file, which currently contains the following:

host all all 192.168.0.1/32 md5

As far as I understand, the instance should accept all users. Is there anything I'm missing here?

4
  • I just tried adding more hosts, no luck.. local, hostssl, hostnossl Same with 1/24 instead of 1/32 (my server is 16 anyway) Commented Apr 29, 2013 at 13:05
  • What's the full, exact text of the error message? The original (not translated back to English) is fine, it's more helpful to have the exact text. Commented Apr 29, 2013 at 13:51
  • Tatalia, do a test. Try to replace the ip address by "0.0.0.0/0" and replace "md5" for "trust". Don't forget to restart the postgresql service. Commented Apr 29, 2013 at 14:44
  • 4
    If you give access to 192.168.0.1/32 and connect from 192.168.0.16, denied access seems like the expected result. Give access to 192.168.0.0/24 for the subnet or 192.168.0.16/32 for just this one host. Commented Apr 29, 2013 at 18:48

1 Answer 1

1

Note that you are trying to connect from 192.168.1.16, however, your pg_hba.conf is allowing only 192.168.0.1 (that's what the /32 means).

Check https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#IPv4_CIDR_blocks to learn more about CIDR notation.

If you want to allow 192.168.1.16 only you can add the following line at your pg_hba.conf:

host all all 192.168.0.16/32 md5

Then, run pg_ctl reload to apply the change made above.

This answer is assuming that you have verified the listen_address parameter in your postgresql.conf file and it's binding the correct IP values.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.