Configure a PostgreSQL database cluster to accept connections

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.

  1. Make a backup copy of the pg_hba.conf file before you alter it.
  2. If PostgreSQL is installed on a Linux server and the PostgreSQL postmaster is already running, stop it using the pg_ctl stop command.
  3. Open the pg_hba.conf file in a text editor.
  4. 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.

  5. Save and close the pg_hba.conf file.
  6. If PostgreSQL is installed on a Linux server, use pg_ctl to start (or restart) the PostgreSQL postmaster.