|
|
|||
![]() |
Department of Engineering |
| University of Cambridge > Engineering Department > computing help |
VNC lets you run a CUED desktop and see the results on a machine elsewhere. You can use the VNC commands (vncserver, etc) from the command line or use a friendlier program (see the Program-specific details section) that runs the lower-level programs for you. You may have trouble the first time you try to connect because it's easy to go wrong, but after that you can save your configuration, making subsequent connections easier.
This is what you do if you're user abc123 and you have the basic software installed.
slogin abc123@gate.eng.cam.ac.uk
slogin ts-access
vncserverIf you're doing for the first time you'll be asked to choose a VNC password. It will reply with something like
New 'X' desktop is scimitar:3 Starting applications specified in /users/s/abc123/.vnc/xstartup Log file is /users/s/abc123/.vnc/scimitar:3.log
ssh -N -f -L 5903:ts-access.eng.cam.ac.uk:5903 abc123@gate.eng.cam.ac.uk
(it's 5903 because the desktop is number 3)
vncviewer localhost:3
(it's :3 because the desktop is number 3). A desktop should appear
vncserver -kill :3
(it's :3 because the desktop is number 3).
You can make this sequence shorter by customising your software, but the details depend on the programs you're using
When vncserver starts, it runs the commands in your ~/.vnc/xstartup file. You can customise this. If you put just this into the file
gnome-session vncserver -kill $DISPLAY
(and ensure the file is executable) you'll get your usual desktop. The last line is so that when you logout out of the session, vncserver exits also.
You might also want to control the initial size of the desktop. Typing
vncserver -geometry 1024x768
should give you a vncviewer session that fits on your desktop comfortably.
The first time you try this something is bound to go wrong. Mostly likely the cause will be a typing error, or commands done in the wrong order, but eventually you may need to know more about what's going on behind the scenes. The rest of the document attempts to explain ports, tunneling and passwords, starting with a simplified scenario and eventually reaching the CUED scenario.
Many things can go wrong. Before reading the Troubleshooting section it's worth knowing a few technical details
So the following set-up is possible.

This is easy to do but there's a problem with it. Because everything you see and type passes between these 2 programs, the connection needs to be secure, otherwise snoopers could get your passwords. ssh ("secure shell") provides secure connections between machines. Don't use VNC without it. ssh uses port 22. Commercial versions of VNC have ssh integrated in. To combine ssh and VNC you'll need to use tunneling.
Tunneling is when traffic for one port travels via another port. ssh has port-forwarding options. For example, this is possible
ssh -L 5901:localhost:5901 -N -f abc123@remote_machine.eng.cam.ac.ukwhere
You'll get the following

Unfortunately, life's not that simple
ssh -N -f -L 5901:ts-access.eng.cam.ac.uk:5901 abc123@gate.eng.cam.ac.uk
does, creating the following situation, which matches the instructions at
the top of the page

New 'X' desktop is tw207:4
If that works, your password and xstartup file are ok. Kill the viewer and run
to kill the server. Now try to use a remote machine that's within CUED.
New 'X' desktop is scimitar:4
ssh -L 5904:localhost:5904 -N -f scimitar
If that works, you're ready to try accessing the CUED machines from outside CUED.
These page have more specialised information
VNC essentially keeps copying screendumps over from a virtual screen on the remote machine to the screen you're sat at. It does this efficiently, so that only modified areas of the screen are copied over. An extra program needs to run on the distant machine and on the local machine, but these needn't be too complex. Because VNC only deals with the end product - the graphics - it doesn't care how the graphics are produced. Some kinds of graphics will produce more network traffic with X11 than with VNC, and some less. According to VNC over SSH2 - A TightVNC Tutorial "Compared to running X over SSH, TightVNC uses more CPU resources on the server side; however, it uses less bandwidth in the remote Desktop Environment tests that were conducted."
VNC is stateless - you can disconnect from a server and reconnect from another machine to continue the session.
Krdc is a Linux program to help with remote access.
slogin abc123@gate.eng.cam.ac.uk
slogin ts-access
vncserverYou'll get something like
New 'X' desktop is scimitar:2 Starting applications specified in /users/s/abc123/.vnc/xstartup Log file is /users/s/abc123/.vnc/scimitar:2.log

and press Return. You'll get the following window. Click on ok

Kwallet will start. Choose a one-off password as you fill in the details.

You'll get a desktop eventually

You'll need at least a window-manager. If you type
gnome-session
in the new window you'll get a familiar environment
This program, available on Linux, can save you some typing.
slogin abc123@gate.eng.cam.ac.uk
slogin ts-access
vncserverIt will reply with something like
New 'X' desktop is scimitar:4 Starting applications specified in /users/s/abc123/.vnc/xstartup Log file is /users/s/abc123/.vnc/scimitar:4.log
ssh -N -f -L 5904:scimitar.eng.cam.ac.uk:5904 abc123@gate.eng.cam.ac.uk(it's 5904 because the desktop is number 4)
slogin abc123@gate.eng.cam.ac.uk
slogin ts-access
vncserverIt will reply with something like
New 'X' desktop is scimitar:4 Starting applications specified in /users/s/abc123/.vnc/xstartup Log file is /users/s/abc123/.vnc/scimitar:4.logIf you're doing for the first time you'll be asked to choose a VNC password.
ssh -N -f -L 5904:scimitar.eng.cam.ac.uk:5904 abc123@gate.eng.cam.ac.uk(it's 5904 because the desktop is number 4). You'll need to use your CUED password. It won't display a message if it succeeds.

The references in the Windows/Vista include general instructions.
One alternative is to do the following - if you're running X windows on your machine (Xwin32/XMing on Windows, or X on MacOS) from your machine, and your ID is abc123 do
slogin -X abc123@gate.eng.cam.ac.uk
then from gate do
slogin -X ts-access
On ts-access you can now type a program's name (e.g. xclock &) and have the display appearing on your machine. This is safe, but it won't be fast (try Matlab for an example). Also you won't be able to enjoy the full CUED desktop experience. But it's easy (especially from a Mac - you might not need to install anything) and might be all you want.
| | computing help | |