Wednesday, October 24, 2012

SSH Tunneling: Shells and VNC Displays

Your graduate work may be insufferably boring, but at least you can prolong the agony from the comfort of your own home.

SSH (Secure SHell) tunneling allows you to connect to a host computer (such as a server) and execute commands remotely from your local computer. In every lab I've worked in, each lab computer connects to a server that everyone can work on; however, you can do this from any location with an SSH terminal. Simply open up a command terminal either using Macintosh's built-in shell or Microsoft's Cygwin emulator, and type in the following command:

ssh username@remoteHost

Where username is your username, and remoteHost is the name or IP address of a remote computer (e.g., a server). Once you have connected simply enter your password and you will be able to navigate around and execute commands on the remote computer.

Should you desire a VNC (Virtual Network Computing) screen - a program which shows you the same desktop and windows as if you were logged in to the remote computer itself - download a VNC client, either realVNC for windows or Chicken of the VNC (I know, right?) for Mac. Then, execute the same command as above, but with the following:

ssh username@remoteHost -L 5915:localhost:5909

In this example, port 5915 is used on the local machine to tunnel into port 5909 on the remote machine. (The port used for the display on your remote server may vary; when connecting to other computers, usually port 22 is the TCP standard for SSH connections.) Once this connection is established, open up your VNC client, set "localhost" as the host you wish to connect to, and connect to the port you opened on your local machine (in this example, port 15, since display 15 is represented by port 5915):

Then hit Connect, enter your password, and you will have a display open on your server. That's all there is to it! Now, instead of using your domestic hours for rest, solitude, and reflection, you can keep toiling endlessly,  your eyes burning and your head splitting from overwork, the cartilage of your phalanges chafed and torn from overuse, as you rush to meet deadlines both real and self-imposed. Your struggles are futile and your heart is faint; to the passing observer your efforts are met with the same mixture of horror and morbid curiosity you would feel watching a lunatic bash his head against the padded walls of his cell. Enjoy.


  1. This is the best computer how-to article I have ever read. It's like the mixture of insanity not being able to do this has caused to me is mirrored back. It's like staring into a mirror, baby, and I see you looking right back at me, and it's not the candy man.

    1. This is probably spam, but good spam; I like how it reads. I'm leaving it up.