Accessing PostgreSQL server through a SSH Tunnel

November 20, 2015

Step 1: Check the SSH connectivity with the server, verify username and password.

Step 2: Create the tunnel in your local system by executing the following command (It will prompt for password):

ssh -fNg -L 5555:localhost:5432 <user>@<server>

Step 3: Now, open your PostgreSQL client (eg, pgAdmin 3 or DBeaver or Postico for OS X or Terminal) and fill in the connection details as usual. Check the image below.

Postico DB connection

Note: Yes, you’ll have to use 'localhost'.

Tags: PostgreSQL SSH Tunnel Hacker

blog comments powered by Disqus