Using VNC on interactive nodes

Security requires that VNC servers not listen on network ports. For this reason it's necessary to start the server with the --localhost option.

To start the VNC server on the remote server run:

vncserver --localhost

If you want to use any other "vncserver" options they need to go before the --localhost option which is really an option to the underlying server binary.

Set a password you'll use later to connect to the server.
Look at the number after the colon that's printed out when the server starts. The port being used is 5900 plus the number after the colon. You can also see your running VNC servers with:

>vncserver -list

TigerVNC server sessions:

:1        32661
:8        31717

On your local machine in two different windows run:

ssh -L 5555:localhost:<port number computed above> remoteservername
vncviewer localhost:5555

The 5555 is arbitrary. Just pick a four digit number over 1024. You should get an X window up with a session on the remote server.

When done with your VNC server you need to kill it. Give the kill option the screen number printed out with the -list option. Something like:

vncserver -kill :1

Optionally, you can start the vncserver with the -autokill option and the VNC server will exit when you logout and you won't have to do the -kill step.

vncserver -autokill --localhost