Tunneling ports through SSH

ssh port tunnelingA nifty trick I picked up today is to tunnel ports through SSH.

I got into this situation where I needed to do some adjustments in the firewall but it was on the other side of the earth and only managable from browser on the LAN.

Only port 22 was open and pointing to a Linux server. (ie no GUI, terminal only)

So what I did in this situation:
From SSH I installed and enabled XRDP on the Linux device and made it listen on port 3389
Enabled the SSH tunneling on my Putty client, defining the following:
Under “Connection” ->SSH->Tunnels
-set “source port” 3390 (choose a free port on your computer)
-set “destination” local IP:3389 (or whichever port you want to tunnel)
An RDP connection to your host is now available via the SSH tunnel:
RDP to

From X terminal on the LAN you are then in control of your firewall with a WEB browser.

The tunneling is supposedly set up just as easy from a Linux client with the following command:
ssh -L 3390: -l remote_user remote_host

If you can’t get in the usual way there are often other means to open a backdoor. Needless to say brute force attacks and various techniques and exploits could be used to gain access. Firewall IPS and IDS systems should be used to prevent this along with strong password policies. Your network is only as secure as the weakest link.


More articles