Skip to main content

Add Remote PgSQL Server

To add a remote PgSQL Server

You can add unlimited  number of remote  PgSQL servers to your Eenos hosting control panel.

PostgreSQL -> Add Remote PgSQL Server

We recommend to add a PgSQL 13 or higher compatible version of remote  database servers

Add A New Server

To add a new server you need to fill out the following,

  • Remote Host : The remote PgSQL server IP or Host Name to connect.
  • Remote PgSQL  User :  The user name to authenticate to the remote  server.
  • Remote User Password : The remote pgsql  user password.

Please  make sure the remote user have admin privileges on remote server , so that the user can create  other users and  databases

You may need to white list the remote server IP in firewall and open the PgSQL outgoing port 5432

How to grant remote user privilege ?

Enabling remote access to postgres is easy.  Please follow the steps below,

 Modify the PostgreSQL configuration file

Open the PostgreSQL configuration file “postgresql.conf” using your preferred text editor. 

Example :  /etc/postgresql/13/main/postgresql.conf

Then, find the line #listen_addresses = 'localhost' and uncomment it (remove the # character at the beginning of the line).

Next, change the value of “listen_addresses” to “*”. This allows PostgreSQL to listen on all available IP addresses. Alternatively, you can specify a specific IP address or a range of IP addresses that are allowed to connect to the server.

Modify the pg_hba.conf file

Open the “pg_hba.conf” file using your preferred text editor. 

Example :  /etc/postgresql/13/main/pg_hba.conf

Take the following section:

# IPv4 local connections: 
host    all             all             127.0.0.1/32            md5 

And modify it this way: 

# IPv4 local connections:
host    all             all             0.0.0.0/0            md5 
Restart PostgreSQL

Run the following command to restart PostgreSQL: 

sudo service postgresql restart

After completing these steps, you should be able to connect to the PostgreSQL server from a remote machine using a PostgreSQL client. However, please note that allowing remote access to a PostgreSQL server can bear a security risk, so it is recommended to use secure passwords, encryption, and firewall rules to protect your system.

Please use a strong complicated password for the remote PgSQL user.