Using VNC

Introduction

       To be able to control the Sun workstation at the beamline remotely from another computer (PC, Mac, Unix, Linux, even inside a web browser), we use a set of programs called "VNC". Establishing the remote connection requires two separate programs. The vnc server program which runs on the machine that you want to control (beamline workstation) and the vnc viewer program which runs on the remote machine you are sitting at (laptop at home). First the server program needs to be started on the machine at the beamline, then you can use the viewer program to connect to it.

Starting Sun VNC server

       A solaris compatible vnc server program called "x11vnc" is installed in ~s4adm/bin on the beams XOR server (by default this directory is in your PATH for all sector 4 accounts). If you want to control a machine called comp-local from a computer called comp-remote do the following:

Step 1: Launch the server program.
At the console of comp-local or in an xterm logged in from a remote machine type:


comp-local> x11vnc -forever -bg -usepw -display :0

The options in this command mean the following:

-forever will keep server running until you log out
-bg       send process to background otherwise ties up xterm
-usepw   prompt for a password when connecting otherwise anybody can connect (see below)
-display display to serve (only one display per instance)


There will then be a bunch of stuff printed out to the screen from x11vnc, until it finally says something like:

.
.
using 32bpp depth=24 true colour 18/07/2003 14:36:31
Autoprobing TCP port 18/07/2003 14:36:31
Autoprobing selected port 5900
PORT=5900
screen setup finished.


which means all is OK, and you are ready to connect.

Step 2: Start the vnc viewer on the comp-remote machine (there lots of VNC viewers which can be downloaded from the web). If you are on another XOR workstation and ~s4adm/bin is in your PATH you can type "vncviewer". You will get a screen asking for the workstation to connect to. Enter it and press return and you should get a screen showing you the screen of the machine you want to control. Moving the mouse into this screen allows you to control the keyboard and mouse of the server workstation. Note if you are on a laptop from home, you need to establish a VPN (Virtual Private Network) connection first. IT will install this program for you on any ANL owned computer.

VNC Viewers

There is a variety of VNC viewers available. The ones that we have been using that work the best when connecting to the SUN are:

PC: The viewer program at at the main VNC site http://www.realvnc.com works best. Note this now a comercial product (there are free versions available also), but IT will install it for you.
Mac OSX: There are several viewers for OSX, while they all seem to work OK for controlling PCs and other MACs they are quite slow for controlling a SUN (complicated reasons). You can get the best performance if you use a viewer is called "VNCviewer" which you can get at http://homepage.mac.com/kedoin/VNC/VNCViewer/index.html

VNC servers for other platforms

You can also get the server programs to control other types of computers PCs, Linux Boxes, & Macs.

Password protecting VNC

x11vnc does not automatically protect the VNC connection with a password. Because of this anyone could in principle connect to the machine where x11vnc is running. To prevent this you need to supply the "-usepw" option above, but first you must create a password file for x11vnc to use by typing the following command:

local-comp> x11vnc –storepasswd

You should get prompted for the following:

  Enter VNC password:
  Verify password:    
  Write password to /home/myname/.vnc/passwd?  [y]/n
  Password written to: /home/myname/.vnc/passwd

You only have to do this once or when you want to change the password


Posted by: Jonathan Lang ( lang@aps.anl.gov)
Content by: Jonathan Lang ( lang@aps.anl.gov)