PostgreSQL Remote Connections

The default value is localhost, which allows only local connections to be made. While client authentication allows fine-grained control over who can access the server, listen_addresses controls which interfaces listen for connection attempts, which can help prevent repeated malicious connection requests on insecure network interfaces. This parameter can only be set at server start.

To enable remote access to PostgreSQL, you have to get the server listening on an interface with routing capability and add a trust entry to permit connections from specific hosts or networks. This is done in the file /var/lib/pgsql/data/postgresql.conf.

listen_addresses = '*'

This will get the server process listening on the other interfaces. Alternatively, you could specific the IP addresses to listen, if you want only specific interfaces to listen for client connections.

listen_addresses = ''

Next, add trust entries for clients that need network access. This is done in the file /var/lib/pgsql/data/pg_hba.conf.

host    all             all            trust
host    all             all            trust

This will get you started with PostgreSQL.

Oct 13th, 2018 • Posted in Databases, PostgreSQL
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>