VNC with an ssh tunnel
If you want a full graphical desktop login and/or if you have already tried ssh -X and it is "slow"
From a Linux (or Mac) computer to one of our Linux computers using an ssh tunnel and VNC
This can be achieved by either of the two methods described below. The first is recommended as it uses a shell script which sets up the ssh tunnel for you. This is easier and more secure. If it fails, you might want to attempt the second, manual set up method.
You will need the following software installed on the local Linux/Mac computer you are going to try this remote access method from: ssh, vncviewer. Mac OS X computers will have ssh installed already but will not have a vncviewer program: we advise installing TigerVNC. Please see the comments at the beginning of the vnccli script (see below) for advice on how to install this. Linux computers may well have a vncviewer installed already, if not we advise installing either TigerVNC or RealVNC
It is sometimes useful to know the version of VNC you are running. To find out (once you have installed a VNC viewer of course) run: vncviewer --version
. If this produces something like "vncviewer: command not found"
then either you have yet to install a vncviewer OR (likely if you are using a Mac) you have neglected to make the vncviewer available in your PATH. Please re-read the comments at the beginning of the vnccli script (see below) and contact the helpdesk if stuck.
Using the vnccli script
To check that the server configuration (i.e. the configuration on the departmental networked Linux desktops) is intact (and assuming that you are physically present in the department) login at the console of a networked desktop, run a terminal and at the shell prompt enter: /alt/applic/vnc/vnccli
. If all is well, a window will appear on the console desktop which shows a second instance of your desktop. This second instance is running on the remote host ssh.maths.cam.ac.uk. If this doesn't produce a second desktop in a window as just described, please enter: rm ~/.vnc/xstartup
and try again. If still no joy please contact the helpdesk.
The point now is to run the vnccli script on your "local" machine (your Linux or Mac laptop, for example). Transfer a copy of the script to your local machine by, for example, running the command scp crsid@ssh.maths.cam.ac.uk:/alt/applic/vnc/vnccli .
(where crsid is your departmental Unix login name) and then run it from a shell prompt: ./vnccli
. Note however, that if your local login name is NOT the same as your departmental Unix login name (very likely to be true if you are on a Mac) then you will need instead to enter: ./vnccli crsid@ssh.maths.cam.ac.uk
. You might like to edit the vnccli script to avoid the need to specify crsid@host on the command line each time you run vnccli, and you might also want to change the remote host used by default: please see the comments at the beginning of the vnccli script for guidance on how to do this.
If at any time your session connection is broken (because of a network outage, for example) then simple re-enter the vnccli command to reconnnect and resume your session. You can avoid the need to enter your departmental Unix password each time you run vnccli by creating a local ssh RSA key and putting a copy of the public part in your ~/.ssh/authorized_keys file on the departmental Unix system. Please see man ssh-keygen
for details.
To end your remote session, just Log Out in the remote window.
The manual set up method
# Login to the Maths computer you want to start your desktop on. # For this example we will use ssh.maths.cam.ac.uk ssh -C ssh.maths.cam.ac.uk # Start the vncserver: vncserver -localhost # give it a password (if this is the first time you run it), and please use a good one exit # Then on your local computer establish the ssh tunnel for VNC: ssh -L 5901:localhost:5901 ssh.maths.cam.ac.uk # then in a new terminal/xterm on your local computer connect vnc to # a local port that is being tunneled (forwarded) over ssh. vncviewer localhost:1 # If this does not perform well then you can try: # These are the options when using realvnc 4.x (and tigervnc): vncviewer -AutoSelect=1 -FullColour -UseLocalCursor localhost:1 # if you have an older version of vnc then try: vncviewer -encodings 'tight copyrect hextile' localhost:1 # Wait and you should get your standard desktop
vncviewer Fonts too Small
Start your vncserver with a -dpi nnn parameter to match your desktop's DPI, desktop environments like XFCE should scale up the fonts to match. e.g. -dpi 96