(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); skip to primary navigationskip to content
 

VNC Viewer for Windows Help

VNC Viewer enables you to connect your Windows machine to a remote system and have a GUI (desktop) as an interface with that system. 

To create a new desktop type:

vncserver -depth 24 -geometry 1280x1024

This will give you a desktop with 24-bit (i.e. good) colour, and a resolution of 1280 by 1024. If you use a larger or smaller screen resolution on your workstation, I suggest you alter the above to match this resolution.

the first time you run the vncserver, it will ask you for a password. This is a password used to use this virtual desktop, and does not have to be the same as your Linux password

This command will create a new 'virtual desktop', and tell you the number of the desktop you have created.

Example output for user abc123:

[abc123@bcni12 abc123]$ vncserver -depth 24 -geometry 1280x1024

You will require a password to access your desktops.

Password:
Verify:
xauth:  creating new authority file /home/abc123/.Xauthority

New 'bcni12:6 (abc123)' desktop is bcni12:6

Starting applications specified in /home/abc123/.vnc/xstartup
Log file is /home/abc123/.vnc/bcni12:6.log

[abc123@bcni12 abc123]$

Write down bcni12:6 on a bit of paper so you don't forget what desktop number you have just created.

You can now log out of the server(s) you are logged into, and connect to the desktop you created using VNCviewer.

Please note - you only really need ONE desktop at a time. Once you have created this desktop, you do not need to do it again, unless the desktop is killed for some reason (e.g. the server is restarted)

Problems with VNC sessions crashing

Make sure the screensaver is not activated, otherwise your VNC session may crash overnight.

 

FAQ about VNC Sessions

our interaction with the BCNI computer systems will mostly be through a VNC session, therefore it's important to know how to manage your VNC sessions.

Creation of a new VNC session is covered above. This section deals with what happens after that.

Normally you only require one VNC session to be running on the BCNI network at any given time. The default VNC desktop environment has four virtual desktops (accessed through the bottom panel) to enable you to organise your work effectively and minimise window clutter.

Please don't create more VNC sessions than you need. Each VNC session uses memory resources. Unused VNC sessions simply use up resources that would be better used for data processing. If your Matlab job is running slowly, it's probably because there are idle VNC sessions on the machine you're using pointlessly consuming the machine's memory.

It's important to realise that VNC sessions are persistent. This means that the session stays running from the time it's created until you terminate it, or it crashes (which does happen sometimes), or the machine it's running on is rebooted. This also means you don't need to create a new VNC session every time you log in (please don't!!!!)

Because VNC sessions are persistent, you need to know what VNC sessions you have running. There are a number of ways to do this. Firstly, each time you log in to one of the BCNI servers, you are told if you have any sessions running on that machine, e.g.

[abc123@iron abc123]$ ssh bcni4
Last login: Mon May 17 10:53:55 2010 from iron

You have the following VNC sessions on this machine:
bcni4.psychol.cam.ac.uk:1

If you need to check what VNC sessions you have running without having to log in again, you can consult the list of processes running on the machine you're currently logged in to. E.g. for user abc123 on bcni4:

[abc123@bcni4 ~]$ ps aux | grep Xvnc | grep abc123
abc123     1884  0.0  0.0   3920   668 pts/7    S+   12:22   0:00 grep Xvnc
abc123    27042  0.0  0.4  25800 20276 ?        S    May17   0:17 Xvnc :1 -desktop bcni4.psychol.cam.ac.uk:1 (abc123) -httpd /usr/share/vnc/classes -auth /home/abc123/.Xauthority -geometry 1024x768 -depth 24 -rfbwait 30000 -rfbauth /home/abc123/.vnc/passwd -rfbport 5901 -pn

Which tells user abc123 that they've got a VNC session using desktop :1 running on this machine (bcni4) and its process id is 27042.

Both these methods tell you about VNC sessions running on a given machine. The only way to tell what VNC sessions you have running anywhere on the BCNI network is to look in your .vnc directory.

Your .vnc directory is where information relating to your VNC sessions is kept. It will look something like this:

[abc123@iron abc123]$ ls -l ~/.vnc
total 104
-rw-rw-r--  1 abc123 abc123  4759 Mar  8 11:50 bcni1.psychol.cam.ac.uk:2.log
-rw-rw-r--  1 abc123 abc123     6 Mar  3 14:13 bcni1.psychol.cam.ac.uk:2.pid
-rw-rw-r--  1 abc123 abc123  4227 Mar 19 19:20 bcni1.psychol.cam.ac.uk:3.log
-rw-rw-r--  1 abc123 abc123     6 Mar 19 16:24 bcni1.psychol.cam.ac.uk:3.pid
-rw-rw-r--  1 abc123 abc123 19736 Feb 25 16:00 bcni1.psychol.cam.ac.uk:7.log
-rw-rw-r--  1 abc123 abc123 12988 Jan 27 14:25 bcni2.psychol.cam.ac.uk:14.log
-rw-rw-r--  1 abc123 abc123  4321 Feb 16 14:40 bcni2.psychol.cam.ac.uk:3.log
-rw-rw-r--  1 abc123 abc123     6 Feb 16 12:59 bcni2.psychol.cam.ac.uk:3.pid
-rw-rw-r--  1 abc123 abc123  7435 Mar 24 10:59 bcni2.psychol.cam.ac.uk:6.log
-rw-rw-r--  1 abc123 abc123     5 Mar 21 11:22 bcni2.psychol.cam.ac.uk:6.pid
-rw-rw-r--  1 abc123 abc123  4814 Jan  7 19:11 bcni3.psychol.cam.ac.uk:5.log
-rw-rw-r--  1 abc123 abc123     6 Nov 19 17:38 bcni3.psychol.cam.ac.uk:5.pid
-rw-rw-r--  1 abc123 abc123  4444 May 17 13:55 bcni4.psychol.cam.ac.uk:1.log
-rw-rw-r--  1 abc123 abc123     6 May 17 10:54 bcni4.psychol.cam.ac.uk:1.pid
-rw-------  1 abc123 abc123     8 Oct 12  2006 passwd
-rwxr-xr-x  1 abc123 abc123   382 Oct 12  2006 xstartup

Here you can see that user abc123 has, or has had, a number of different VNC sessions on four different machines (bcni1, bcni2, bcni3, bcni4).

The *.log files record when a session was created and when you connected and disconnected from the server, plus other information which might help debugging in the event of a session crash.

The *.pid files record the process id of the VNC server process.

The passwd and xstartup files shouldn't be touched unless you understand what you're doing.

From the above listing, we'd expect user abc123 to have six VNC sessions currently, as there are six .pid files.

This might not be the case, however, as .pid files will not be removed if a machine is rebooted, so in the example above, if bcni2 had been rebooted more recently than February 16th, the files referring to VNC session bcni2.psychol.cam.ac.uk:3 will now be obsolete as that VNC session will have been terminated when bcni2 was rebooted. The same would be true if session bcni2.psychol.cam.ac.uk:3 had simply crashed. For this reason it's a good idea to tidy up the contents of your .vnc directory periodically to remove obsolete .log and .pid files.

How to kill a VNC session.

The approved way of killing a VNC session is to use the vncserver command with the -kill flag. E.g. to kill VNC session :1 on bcni4, user abc123 should do:

[abc123@bcni4 abc123]$ vncserver -kill :1

It's important a VNC session is killed this way as this ensures the associated .pid file is removed from your .vnc directory.

Note also you need to be logged in to the appropriate machine when giving the above command: if the command prompt is on bcni4, you can only kill VNC sessions on that machine.

If you run the vncserver command as above with the wrong desktop number, you'll get a message like:

[abc123@bcni4 ~]$ vncserver -kill :4

Can't find file /home/abc123/.vnc/bcni4.psychol.cam.ac.uk:4.pid
You'll have to kill the Xvnc process manually

This can happen if you remove the .pid file while the VNC session is still running. I have heard it said that the way to kill a VNC session is to remove the .pid file. This is wrong. If you get a message as above, check you've got the desktop number correct by running the ps command in the example above.