By default, only clients running on the same machine as the PostgreSQL database cluster can connect to it. To allow remote clients to connect to the database cluster, alter the PostgreSQL pg_hba.conf configuration file.
The following steps summarize what you need to do to allow connections from clients on machines that are remote from the PostgreSQL server. The entries you place in the pg_hba.conf will vary depending on security policies and configurations at your site.
- Make a backup copy of the pg_hba.conf file before you alter it.
- If PostgreSQL is installed on a Linux server and the PostgreSQL postmaster is already running, stop it using the pg_ctl stop command.
- Open the pg_hba.conf file in a text editor.
- Add the IP addresses of connecting client machines, designate the database or databases each IP address can connect to, and specify the client authentication methods used for connections.
See the PostgreSQL documentation for more information.
- Save and close the pg_hba.conf file.
- If PostgreSQL is installed on a Linux server, use pg_ctl to start (or restart) the PostgreSQL postmaster.