skip to content
 

You can connect to an existing desktop session on your linux workstation with VNC.


Prerequisites


On your workstation you will need a VNC server:



sudo apt-get install x11vnc


On the machine you are connecting from you will need a VNC client. We suggest remmina (linux), Real VNC Viewer (Windows, OSX).


Connecting to your workstation


If you have an existing desktop session running on your linux workstation, you should be able to connect remotely to it with VNC. To do this, simply lock your screen before you leave it (Ctrl+Alt+L).


ssh to your workstation and forward some ports (in this example just called workstation). You will need to be on the department network (e.g VPN, ChemNet):



ssh -L 5900:localhost:5900 CRSID@workstation.ch.private.cam.ac.uk

# Set a VNC password (you should only need to do this once).
x11vnc -storepasswd

# Start the VNC server
x11vnc -clientdpms -ncache 10 -rfbauth ~/.vnc/passwd -display :0 -localhost


Then just connect your vnc client to localhost.




Connecting through a bastion host


For the following commands you will need to substitude CRSID for your CRSID. You will also need to substitiute workstation.ch.private.cam.ac.uk with the fully qualified hostname of your workstation. You can obtain this by typing "hostname -f" in a terminal window.


Method 1



ssh -L 5900:localhost:5900 CRSID@citadel.ch.cam.ac.uk
# then
ssh -L 5900:localhost:5900 CRSID@workstation.ch.private.cam.ac.uk


then start the VNC server and point your client at localhost


Method 2 (Proxy Command)


In your ~/.ssh/config file, add the following lines substituting in the fully qualified name of your workstation:


Host workstation

    User CRSID

    Hostname workstation.ch.private.cam.ac.uk

    ProxyCommand ssh CRSID@citadel.ch.cam.ac.uk -W workstation.ch.private.cam.ac.uk:%p


Then ssh to "workstation":


ssh -L 5900:localhost:5900 workstation


then start the VNC server and point your client at localhost.


Method 3 (Using Putty)


If you are trying to connect from a windows machine you may like to use putty to set up the tunneling. Under Session enter the following.


citadel.ch.cam.ac.uk


Then under Connection->SSH->Tunnels enter the following and click on Add.



You should then see the tunnel listed:



At this point under Session->Saved Sessions, you may wish to give it a name and save the settings. Click "Open" and this should ssh to citadel forwarding those ports. When prompted for a username and password, enter your CRSID and your admitto credentials. When you have succesfully logged ssh to your workstation:



ssh -L 5900:localhost:5900 CRSID@workstation.ch.private.cam.ac.uk


and start the vnc server, then point your vnc client at localhost.

Can't find what you're looking for?

Then you might find our A-Z site index useful. Or, you can search the site using the box at the top of the page, or by clicking here.