remote control

How to remotely use your workstation with ssh and vnc

I assume that you use a Unix-like operative system, but this apply to any OS.

Let’s say about a problem: you are in your office, you are waiting for some kind of simulation to end. Everything seems to go well, so you go home, quite confident that the next morning you’ll have some results to analyze.

Unfortunately, it’s unlikely to happen. Ten seconds after your departure, the program ends for a low-frequency bug that you missed.

Luckily, we have a solution for the future. Instead of losing a long night (or even a weekend) of program executions, you can check your office workstation when you are at home, in your warm bed, or everywhere you like to be (with an internet connection, ça va sans dire).

What do you need in your workstation?

You need to install (or ask the sysadmin to install):

  1. the ssh server
  2. a vnc server: x11vnc

Remember to ask the sysadmin:

  1. the public IP of your workstation
  2. the range of unused open ports, if the workstation is behind a router

What do you have to do from home?

Ok, now it’s very simple. You’ll only need to install a vncviewer, but you’ll probably already have one. Let’s say that your workstation username is goofy, the public IP is 1.0.0.1, and the free open port on the workstation is the 5900. Now we need another port, this time a local one (of your home computer), to create the http tunnel. I suggest the port 5901:

ssh -p 42 -L 5901:localhost:5900 goofy@1.0.0.1

You’ll have to insert your workstation password, and then you can explore with the shell your remote operative system. If you want to use it graphically, only execute the command:

x11vnc

Wait for 5-6 seconds, then open another shell without closing the current one, and type the following:

vncviewer localhost::5901

Et voilà! You have to move your mouse on the new black window, and then you’ll see the remote display to appear.

Advertisements