Accessing an X-windows session from home

An X-windows session can be viewed over the internet from any type of computer (Linux, Windows, Apple). This will allow the use of programs such as Maple, Matlab, R, Splus, SAS, LaTeX, Ghostview, etc. (including graphics capabilities).

Through the combined use of SSH and VNC, a secure X-windows session can be initiated. SSH will also allow the use of VNC through a firewall (such as the firewall on Res-net at Montana State University). The tutorial below is assuming that we are installing the vnc server on a machine called "gauss". Install the server on the machine you really intend to!

Installing VNC on gauss

The latest version of VNC might not be installed on gauss. However, as long as you have shell access to gauss, it is possible to install it in your own home directory. A guideline is shown below. The steps need to be done on gauss, or alternatively, the Solaris binaries can be downloaded and transfered to gauss using scp. One option is to use the links text-based web browser -- a very nice solution!

  1. Download VNC from Look for the Free Solaris 7 (SPARC) (GZipped Tarfile)) Edition.
  2. Unzip the tar.gz file with
          gunzip vnc-4_1_1-sparc_solaris.tar.gz
  3. Untar the archive using the command
          tar -xvf vnc-4_1_1-sparc_solaris.tar
  4. Enter the directory created by the archive and enter the following command:
          vncinstall ~/bin ~/man
  5. If you prefer, you can clean up the installation files with the following commands (Beware of the rm -rf command! You can delete the contents of an entire directory this way. Make sure you name the correct directory before hitting enter!)
          cd ..
          rm -rf vnc-4_1_1-sparc_solaris
          rm vnc-4_1_1-sparc_solaris.tar
  6. Edit the ~/.vnc/xstartup file to choose an appropriate windows manager. Alternatively, download xstartup, which uses the xfwm windows manager (Save in the ~/.vnc directory).

Starting a VNC Server session on gauss from home using Putty

If a Mac or any other platform is used, then download the appropriate VNC viewer along with an ssh client. Another ssh option is the Mindterm Java SSH client. It has the ability to initiate tunnels (in version 2.0 or newer). Since it was written in Java, you can use it in any web-enabled browser.

The steps below illustrate the use of VNC through Putty, a free SSH client for Windows. Use the steps below as a guideline for other platforms.

  1. First, download the file putty.exe from here. Save it to the desktop or to any other directory you'd like to keep it in.
  2. Double click on the putty icon. Then type in what is in the window below. Click Save. Click on gauss. Click Open.

  3. A putty window will now appear. Log into gauss. The first time putty is used to log into gauss, it will say "The authenticity of host '' can't be established". Check the key fingerprint putty specifies is the actual gauss fingerprint. Click yes if the fingerprints match. At the command prompt, type vncserver. If you see a message similar to below, then a VNC server was successfully started. The first time the program is run, it will ask you to choose a password. Choose a password different from your gauss password (although your gauss password would be fine). Make a note of the display number of the VNC server (3 in the window below).

  4. Logout from the putty session by typing logout. Be sure and remember the display number of the VNC server.
  5. You only need to start a VNC server once (unless gauss has been rebooted, which happens about every 3 months).

If you want to kill a VNC session, the display name and number are required. Current session names can be found in the ~/.vnc directory (off of your home directory). The command is:

      vncserver -kill gauss:3

Setting up an SSH tunnel using Putty

In order to connect securely to a VNC Server, you need to set up an SSH tunnel. This guide should provide adequate details for establishing an SSH tunnel using Putty on Windows 95/98/ME/2000/XP. Other SSH programs can be used, including the one from (download the file called SSHSecureShellClient). This tutorial will focus on the procedures for Putty, though similar procedures will work for the client.

  1. First, a putty session for use with VNC must be set up. Double click on the putty icon. Click on the SSH tab on the left. Then click on 2 for the preferred SSH protocol.

  2. Next, Click on the Tunnels tab. For Source port, type 5901. For Destination, type localhost:59xx, where xx is the display number from the previous section (03 in this example.) Click on the dot next to Local. Click on Add.

  3. The window should now look like this. Click on the Session tab.

  4. Next, enter the information below and choose a Session name under the Saved Sessions window. Click on Save.

  5. Click on Cancel (We don't want to connect to gauss yet). We want to set up a shortcut on the desktop which starts an ssh tunnel for VNC.

  6. Right click on the putty.exe icon. Select Create Shortcut.

  7. Right click on the shortcut icon, and select rename. Choose vnc as its new name (or any other name you want). Move the shortcut to the desktop if it isn't there already.

  8. Right click on the VNC shortcut icon. Select properties.

  9. At the end of the Target line (after putty.exe), enter -load "session", where session is the session name you chose before ("gauss (vnc)" in this example). If there is a quotation mark after putty.exe, then enter -load "session" after the quotation mark. Click OK.

  10. Next, download the Windows VNC viewer command. It is located at Select Download and Use the Free Edition, then click on Proceed to download. Download the executable(.exe) in the Windows Stand Alone Viewer part. Save it to the desktop or to any other directory you'd like. (Rename it if you like. I renamed this one to vncviewer.exe). If you save it somewhere else besides the desktop, I'd suggest you make a shortcut to it on the desktop like the vnc shortcut.

Connecting to a running VNC server

  1. Double click on the VNC icon. Login to gauss. DO NOT CLOSE this window while you are using the VNC viewer. An SSH tunnel has been initiated that will exchange information between the VNC server and the VNC viewer. The best idea is to minimize the window. Click on the underscore button in the top right of the putty window.

  2. Double click on the VNC viewer icon. Type in localhost:1 for the VNC server part. Click OK.

  3. Enter your VNC server password.

  4. Your VNC session should pop up.
  5. Now try and run SAS, Splus, Maple, Matlab, etc.
If you find the password prompt does not come up, but rather says that it was unable to connect, then gauss was probably rebooted. You need to start a new VNC server.
Scott Hyde
Last modified: Sun Jan 22 08:48:52 HST 2006