Operations > Computing > FAQ

Unix VNC Sessions

VNC allows graphical programs (e.g. MATLAB, CAD software, etc.) 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 be able to be setup if your account is over quota.

  1. Start a VNC Session
  2. Connect using TightVNC
  3. Connect using another client
  4. Close your VNC session
  5. Reset your VNC session password
  6. Alternatives to VNC

Start a VNC Session

  1. Connect to an ECE Linux Lab system using a SSH client. It is best to use linuxsrv01.ece.uw.edu or one of the other non-lab linux lab systems, as these are less likely to be rebooted or unplugged.
  2. Run vncserver -list to see what sessions have been started.
  3. If none have been started, launch a new server with the following command:
    vncserver -interface

    The first time, a password will be asked for; this password will help prevent other users from accessing your VNC session. If you forget this password, remove the ~/.vnc directory then retry these setup steps.

  4. Now the -list command should show a session (the numbers will vary):
    linux13$ vncserver -list
    TigerVNC server sessions:
    :1		5528
  5. Use the lsof command to show the port number the process is listening on, in this case 5901. The port number may vary if other sessions exist. This port must match the port used when connecting with the VNC client.
  6. linux13$ /usr/sbin/lsof -i -P | grep vnc
    Xvnc 7131 nemo   6u IPv4 594464   0t0  TCP localhost:5901

Connect using TightVNC

On both Windows and Mac, we recommend using the TightVNC Java Viewer (note that you'll also have to install Oracle's current Java Runtime).

TightVNC can simplify the process of creating an SSH port forward to secure your connection to the VNC server by selecting the "Use SSH tunneling" option. Enable this option, then enter the hostname of the system where you started the VNC session, and your UW username.

Connect using another client

If your VNC client doesn't support creating an SSH tunnel, as in the previous example, then you will need to create an SSH tunnel manually. Use the "local port forward" option to open a TCP port on your own system and forward those connections to the host where your VNC session is running. For example, if your session is running on linux13 and listening on port 5901:

mylaptop$ ssh linux13 -L 5901:localhost:5901

Once connected to by ssh, you can then connect your VNC viewer to localhost port 5901. The VNC client will connect to the port on your own system that ssh has opened, and ssh will forward that connection to the remote system.

Close your VNC session

Use the vncserver -list command and then vncserver -kill command to quit any sessions that need not remain open.

linux13$ vncserver -list

TigerVNC server sessions:

:1		7131
linux13$ vncserver -kill :1
Killing Xvnc process ID 7131

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:

linux13$ cd
linux13$ pwd
linux13$ rm -rf .vnc
# and to be really sure nothing is running...
linux13$ pkill -u $USER Xvnc

Then, head back up to the top of the page to start a new server listening. (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.)

Alternatives to VNC

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. The Eight Fallacies of Distributed Computing might make for good reading.

ECE logo