Haraball.no

Query postgres database via ssh tunnel

2016-10-14

To connect to a postgres server via a ssh tunnel, first set up the tunnel:

ssh -L 63333:localhost:5432 harald@ip.ad.dr.ess

Then fire up the client pointing to the port you specified in the previous command:

psql -h localhost -p 63333 postgres