Page tree
Skip to end of metadata
Go to start of metadata

Sometimes you need to provide remote administration where you can not directly connect to your server via ssh and create tunnels. For security reasons, by default, postgresql disables all remote connections.

Only do this if SSH tunnels is not possible. SSH with Keys is the preferred method for providing remote administration.

Here are my notes on how to make postgresql sql available to other systems on the same network. I found these instructions to be the easiest and generally secure. If you have a good understanding of networking, you can further lock this down.

sudo vi /etc/postgresql/8.4/main/postgresql.conf

Search for this line,

#listen_addresses = 'localhost'         # what IP address(es) to listen on;

Change to,

listen_addresses = '*'         # what IP address(es) to listen on;

Modify,

sudo vi /etc/postgresql/8.4/main/pg_hba.conf

And add this line to the bottom of the file where 192.168.0.0/16 is reflective of your particular network range. In this example, we are saying to allow any computer on the local network (in this case subnet 192.168.x.x) to connect to any database. The md5 indicates that the user must also supply a password.

# Allow local connections from local network
host    all         all        192.168.0.0/16         md5

Restart the postgres service,

sudo service postgresql restart
  • No labels