Poor man's vpn

Did you ever needed a simple connection to your home-server or a remote desktop to that Windows server at work? Most people would suggest to set up some expensive VPN hardware or other third party solution like LogMeIn but if you can reach that port 22 on the other side there’s some simple solution: ssh, the secure shell protocol

What do you need?
- a SSH-server listing on the other side
- a SSH client like PuTTY or just ssh in Ubuntu on your local machine

How does it work?
The basic idea is that you setup a local port on your local machine to forward a connection to a remote host port through the SSH connection.

1st example: connect to that Windows machine with remote-desktop

Just imagine that you want to connect to a Windows machine with remote-desktop (RDP) on your work or home. You could forward a port in your firewall rules at home, but most companies wouldn’t allow that and portforwarding wouldn’t work if you have dynamic IP adresses. Open up a console and type:

sudo ssh -L 3389:remote-windows-pc:3389 username@ssh-server

You will be prompted twice for a password, first your local sudo password and second the ssh password for the ssh-server. After the connection is established you can use your favorite remote-desktop client to connect to your localhost and you will see a Windows login screen from your remote machine.

2nd example: using PuTTY and Windows

If you’re restricted to Windows instead of Linux you can use PuTTY.

  1. Install putty. Download it here if you are using Windows. Debian or Ubuntu users can do an apt-get install putty
  2. Configure a basic connection (host and port).
  3. Go to Connections→SSH→Tunnels
  4. Add the configuration of the remote-desktop
    1. In source port, put 3389
    2. On destination, use the remote IP or hostname and the remote port (remote-ip:portnumber)
    3. Push the Add button
  5. Save your changes
  6. Connect to the server using PuTTY. You don’t need to be the root user on the remote server in this case
  7. Now use your remote-desktop client and connect to localhost
  8. You will see a Windows login screen from your remote machine

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>