SSH Tunneling

If you have PostgreSQL databases hosted remotely, SSH tunneling provides a convenient and secure communications mechanism. This approach avoids issues with SSL certificate configuration and obviates the need to modify the pg_hba.conf file to setup host permissions. The primary disadvantage is that some hosting providers do not allow SSH access (or only provide it on more expensive accounts).

Here is an example to setup SSH tunneling for PostgreSQL:

ssh -L 5555:localhost:5432 -l remoteuser

This forwards connections made on localhost port 5555 to port 5432. The -l parameter is your user name for shell access on the remote system (not your PostgreSQL user name).

So to use pgEdit, pgAdmin, or any other PostgreSQL utility, use localhost and port 5555 along with the same login credentials you would normally provide to connect to the database.