Using VNC for remote X access

VNC is a protocol that provides remote X access which is *MUCH* faster than normal X over a wide-area network, even a fast one. It is included in most Linux distributions and is available for other platforms -- search for VNC in Google. Here is how to use it:

(1) Login to quark via SSH as usual and type

	vncserver
This will prompt you for a password and display a remore access port, e.g., quark.phy.bnl.gov:3. Remember the port number and your password.

(2) On your remote computer type

	vncviewer -via quark.phy.bnl.gov quark.phy.bnl.gov:3
where the screen number (here 3) should match that displayed after (1). This opens a VNC session via SSH. Enter your password when prompted.

(3) You should see a window with a shell on quark. You can type any command in this window, e.g., firefox, which will start a Web browser inside the BNL firewall.

(4) When you are finished, go back to the shell from (1) and type

	vnckill 
This is a script in /usr/local/bin that will kill your VNC process and clean up the VNC files in your home directory. This is important to remove unused processes and to leave slots available for other users.


Here is how to set up the vnc server on clients like windoze or mac that don't include the via option:

As above, on quark: run "vncserver" and note the port number, i.e. 1. Add this number to 5900, i.e. 5901 and remember it You can close this terminal if you want.

On your local machine run

	ssh -L 590x:quark:590x username@quark.phy.bnl.gov
with "x" being the above small integer. Leave this terminal running.

Open the viewer client and connect to "localhost:x" with "x" the above small integer. If this doesn't work try "localhost:590x"; the mac client seems to do it this way.

When done with the virtual session, on quark

	vncserver -k :display#
gets rid of it. You can do this from the window left running above. Alternatively you can use the vnckill script mentioned above.

If you don't kill the server you can disconnect and reconnect to it later and whatever you left running there will still be there.


You can do all this in reverse to connect to a vncserver on your home machine, but why would you want to do that? ;)=