Skip to main content

About Linux VNC Sessions

VNC allows graphical programs to be run remotely with the ability to reconnect to that session should the network connection fail. The ECE Linux Lab systems have VNC software installed.

VNC sessions will not start if your account is over the disk quota.

Make Sure You Have the Software

The following software is required - it works on both Windows and macOS:

  • Oracle's Java Runtime. The VNC software unfortunately does not appear to be compatible with other Java engines.
  • TightVNC Java Viewer. Be sure you download the Java Viewer from that page, not the Windows version or anything else.
  • Husky OnNet. Unless you are physically on campus, you will not be able to connect remotely to our Linux machines without Husky OnNet.
  • Terminal emulator - you will need a terminal to run SSH. The Mac has one built-in - it's located at Applications -> Utilities -> Terminal. If you're using Windows, Download PuTTY.

Start a VNC Session

In the examples below, linux-lab-069.ece.uw.edu is being used (and the example user's NetID is nemo).

  1. Open your terminal program and connect to one of the Linux Lab systems using SSH.

    If you're not sure of the name of the machine to which you've connected, use the hostname command:

    [nemo@linux-lab-069 ~]$ hostname
    linux-lab-069.ece.uw.edu
    
  2. Set a VNC password by running vncpasswd at the command prompt. Note that VNC passwords must be 8 characters or less - if you type a longer password, everything after character eight is ignored. (Technically you don't need to set up a new VNC password if you've previously created one, but doing this each time ensures you remember what it is!)

    Note that while you're typing your password on Linux, you will not see any feedback at all (no asterisks).

  3. You can start a VNC session by using the vncserver command as follows:
    [nemo@linux-lab-069 ~]$ vncserver -interface 127.0.0.1
    
    New 'linux-lab-069.ece.uw.edu:2 (nemo)' desktop is linux-lab-069.ece.uw.edu:2
    
    Starting applications specified in /homes/nemo/.vnc/xstartup
    Log file is /homes/nemo/.vnc/linux-lab-069.ece.uw.edu:2.log
    
    To verify whether a VNC session is already running, use the "-list" argument:
    [nemo@linux-lab-069 ~]$ vncserver -list
    
    TigerVNC server sessions:
    
    X DISPLAY #	PROCESS ID
    :2		11720
    
  4. Take note of the display number associated with the session. VNC ports start at 5900 - so when TigerVNC refers to "Display :2", the port number VNC maps to that display is 5900 + 2 = 5902. If it tells you the display is ":3", you'd need to use port 5903; and so on.

With your VNC session now running, you can now connect to that hostname and port number using TightVNC.

Connect using TightVNC Java Client

The ECE Linux Lab machines require you forward your VNC session over SSH, which is why we only support use of the TightVNC Java Viewer - that software can manage SSH forwarding automatically. Launch TightVNC's Java Viewer, then do the following:

  1. For "Remote Host", use either "localhost" or "127.0.0.1"
  2. For "Port", use the port number from steps 3 and 4 of the previous section (e.g. 5902 in this example)
  3. You must check the box "Use SSH tunneling"
  4. "SSH Server" must be the name of the server you started the VNC server on (linux-lab-069.ece.uw.edu in this example)
  5. "SSH Port" must be "22"
  6. "SSH User" is your NetID - if you leave this blank, you will be asked for it right after the next step
  7. Once you've filled in all the fields, hit the "Connect" button

After pressing the Connect button, you will be asked for two passwords. First, you will need to provide your UW NetID password. The next prompt will ask for the VNC password you chose when you set up the VNC session.

There may be somewhat of a delay, but after all this you should soon see a new VNC window containing a Linux desktop session. If you see a blank window, be patient for a bit - but if it continues to be blank, end the current session and try starting over again using a different Linux Lab machine - the one you chose may already be bogged down with too many other users.

IMPORTANT: Close Your VNC Session When Finished!

From the command line on the remote machine, use the vncserver -list command to determine the display number of your VNC session. Then, run vncserver -kill to quit any sessions which need not remain open (note that you do not add 5900 in this case - use the exact display number reported).

[nemo@linux-lab-069 ~]$ vncserver -list

TigerVNC server sessions:

X DISPLAY #	PROCESS ID
:2		11720
[nemo@linux-lab-069 ~]$ vncserver -kill :2
Killing Xvnc process ID 11720

If You Need to Reset Your VNC Session Password

Close any VNC sessions as in the previous section, then delete the ~/.vnc directory. This will wipe out any saved password for the VNC session:

[nemo@linux-lab-069 ~]$ cd
[nemo@linux-lab-069 ~]$ pwd
/homes/nemo
[nemo@linux-lab-069 ~]$ rm .vnc/passwd

And to be really sure nothing is running...

[nemo@linux-lab-069 ~]$ pkill -u $USER Xvnc

Then, return to the top of the page to start a new server.

Note: things will be more complicated if you have started VNC server sessions on multiple hosts. The easy way to avoid this problem is to not do that.

Appendix 1: Connecting Using a Different Client

ECE Computing does not offer support for this. We provide this information for those adventurous and/or foolhardy enough to venture out on their own. It is published under the "you break it, you get to keep both pieces" license.

Most VNC clients other than the TightVNC Java Viewer do not have the ability to set up an SSH tunnel. If you choose to use something else, you'll need to manually set up an SSH tunnel separately - and will need to do it before launching your VNC session.

If your personal computer is running Linux or macOS, you can set up SSH tunneling from the command line using a command something like the following (as before, you'll need to replace nemo with your own NetID, and 5902 with the port number from that startvnc told you):

mylaptop$ ssh nemo@linux-lab-069.ece.uw.edu -L 5902:localhost:5902

Once you've successfully set up the SSH tunnel, you can then connect your VNC viewer to localhost on the selected port (5902 or whatever).

Appendix 2: Alternatives to VNC

Note that ECE Computing offers this information for Linux-knowledgable students to attempt on their own. You will be expected to troubleshoot and resolve any issues yourself.

Another option is to use Xming to run X11 applications, though this relies on an active connection, and will fail when the network fails for any reason. Yet another option is x2go.