May 22, 2009

SSH as an alternative to VPN

I wanted to have access to my work PC (Windows XP) from my laptop at home(openSUSE) I had access to a VPN server, but connections were not always reliable. Hence I looked out for alternatives and found this method from some blog posts. I have been working with this setup for a long time and its been 100% reliable than the VPN method that I used before. The method is simple, secure and uses SSH to setup a tunnel between the local and remote machines

The basic requirements are

  • An account on an SSH server (or you could setup one on your work PC)
  • Work PC is a Windows machine with remote desktop enabled.
  • Both machines are on the same network and have static IP addresses

On my openSUSE laptop, I use the following command

ssh -C -L 3389:workpc:3389 vimal@ssh-server

#substitute workpc and ssh-server for IP addresses if they are not in /etc/hosts

After logging in with my password, I use krdc and connect to an remote desktop session(rdp) using localhost:3389 for server and port. After reviewing the keyboard and display settings, I can logon to my work PC. Its that simple.

To avoid typing the ssh command everytime, I created a script called connectwork in my bin directory and made it executable with

chmod u+x ~/bin/connectwork

Now I just need to call connectwork everytime I wish to connect and login to my work computer.

ssh -C -L 3389:workpc:3389 vimal@ssh-server

Click Here!