PostgreSQL remote incoming connections

PostgreSQL

Configure PostgreSQL remote incoming connections

By default PostgreSQL does not accept remote connections.
So, when you try to connect from remote machine you will receive an error:
could not connect to server: Connection refused
Is the server running on host host.domain.com and accepting
TCP/IP connections on port 5432?

1. For allowing listening remote incoming TCP connections you have to add the following line into your postgresql.conf file (/etc/postgresql/8.4/main/postgresql.conf):

listen_addresses = '0.0.0.0'

postgresql.conf

2.  Add this line to the end pg_hba.conf file (/etc/postgresql/8.4/main/pg_hba.conf) will allow connections from any address with password authentication:

host all all 0.0.0.0/0 md5

3. After these modifications you need to restart PostgreSQL server.

Do not forget edit your firewall rules and allowing incoming connections on port 5432

arstech

Leave a Reply