SSH Tunnels
03 March 2009

I have been using Linux and SSH for years now and I'm surprised I have not yet needed to create an SSH tunnel. The need for the tunnel was to connect to a remote PostGRES database that didn't allow remote connections.

What I did was create a tunnel from my local port 5432 to the remote server's port 5432 over SSH. The command looked like this:

ssh -L 5432: root@ -p 2222 -N

Where is the remote machine. 5432 is the PostGRES port and 2222 is the SSH port.
It worked first try!