Access remote TCP ports with OpenSSH tunnels

Posted August 28, 2003 by Quinn McHenry in UNIX

Using OpenSSH, it is possible to access TCP ports on remote systems, even those not on the host you are ssh’ing to, using tunnels.

If the remote system you are connecting to with shh is called ‘sadie’ and the target host with the desirable TCP port of 1433 is named ‘molly’ the command to build the tunnel between them is:

ssh -L 1433:molly:1433 sadie

Once you authenticate with ssh, you can access port 1433 on molly as though it were on your system. Make sure that the remote system (sadie) can resolve the name of the target system (molly). You can use IP addresses instead of names.

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.