Katahdin is the login node for the Katahdin cluster. It allows you to access your data via a graphical environment and run programs such as Matlab, ncview, etc. interactively. VNC is a good way to be able to use that capability.
It is possible to connect to the system securely using VNC with the help of SSH. Since Katahdin has only the SSH port open to the outside, the VNC ports need to be tunneled through SSH to a port on your machine. How this is set up depends on what SSH client you use and what vncviewer program you use.
VNC has two parts, the VNC Server and the VNC Viewer (client). The Server program is run on the machine that you want to have access to. The Viewer program is run on a remote machine to connect to the server and display the servers desktop.
1. The Server: Setting up the VNC server on Katahdin
The first thing to do is to set up the VNC server on katahdin. To do this, first ssh in to your account and run the command:
If this is the first time that you have run this command it will ask you to set up a password. The output of this command will look something like this:
You will require a password to access your desktops.
xauth: creating new authority file /home/guest/.Xauthority
New ‘Katahdin:19 (guest)’ desktop is Katahdin:19
Creating default startup script /home/guest/.vnc/xstartup
Starting applications specified in /home/guest/.vnc/xstartup
Log file is /home/guest/.vnc/katahdin:19.log
At this point you have a VNC server running on display :19. You will use this information later when you want to connect to it.
IMPORTANT: Port 19 is just an example. Your display number will likely be different. If you forget what Display number your server is running on you can use the “vnccheck” command on katahdin.
2. The Viewer: Connecting to the VNC Server using SSH encryption:
This is a little convoluted only because most of the free versions of VNC don’t include encryption directly so in some cases you need to combine two programs to make it work. This isn’t the case in most Linux versions though so let’s start with the easy case:
If you don’t have vncviewer on your Linux machine then you will need to install one. Usually you can use your package manager to do this for you. Search for “vncviewer” and your Linux distribution to see how to install one of the versions of VNC.
Once you have vncviewer, the command-line vncviewer program on your Linux machine will likely have the “-via” option that sets up the ssh tunneling for you. In the above case with display :19 the command you would use is:
vncviewer -via email@example.com :19
where “username” is your account name and you would substitute your display number for :19. It will first ssh into Katahdin (asking for your Katahdin login password) and then it will bring up a login to the VNC Server. You will use the VNC password that you configured when you first ran the “vncserver” command on Katahdin. Once you login a window should pop up that is your Katahdin desktop session.
For Windows there are two components to set up. First you need to set up your SSH client (I’m assuming Putty for this) to tunnel the display port number from Katahdin to your computer. In the example we are using here the Display number is 19. In VNC, the port that is used is 5900 plus the Display number so it would be 5919.
Setting up PuTTY:
Bring up PuTTY and load the Saved Session that you use for connecting to Katahdin (highlight the session and hit the “Load” button).
In the left-hand window click on the “plus” sign next to the “SSH” option under Connection. Then click on “Tunnels”
Now in the right side of the window there will be a box titled “Forwarded ports”. If this is the first time you have done this then this will be blank. If there is an entry that looks like: “L5919 localhost:5919” then you are already have this set up and you can skip the rest of this section.
Under the “Forwarded ports” box is “Add new forwarded port:” with a box for “Source port”. Enter 5919 here. In the “Destination” field enter: localhost:5919 and then hit the “Add” button.
(optional) In the left box click on the “SSH” item and check the box that says “Enable compression” to improve performance.
In the left box of the Putty Configuration window go all the way to the top and click on the “Session” item. On the right-hand side of the Window now hit the “Save” button to save your session.
This part is done. Now when you open that session, it will allow you to login to Katahdin as usual but it will also be setting up an encrypted “tunnel” from port 5919 on Katahdin to port 5919 on your machine. This will be used in the next step.
Important: This tunnel will only be active as long as this SSH session is open. So, in order to use VNC to connect to Katahdin, you need to make sure that you connect to Katahdin with PuTTY using this Saved Session first.
Running vnciewer on your machine:
First make sure that you have logged into Katahdin with the saved session that you created above that sets up the tunnel.
Now run your Windows VNC Viewer program. If you don’t have one, then you can install one from http://www.realvnc.com/download/viewer/
In the VNC Server dialog enter: localhost:5919 I am using 5919 to match our example. The port will likely be different in your case. It should be 5900 plus the Display number that was given to you when you ran the vncserver program on Katahdin.
Hit the “Connect” button and login with the password that you set up when you ran the vncserver program on Katahdin.
At this point the Linux Desktop from Katahdin should appear in a window.
OS X now includes a VNC viewer. To use it you can just go to Safari and enter a VNC URL. For our example we are using Display :19 (check with the vnccheck command on katahdin to see what your Display is and adjust accordingly) which corresponds to port 5919 (just add 5900 to the Display number). But first we need to set up the Tunnel to connect to the VNC server through ssh.
1. Set up the tunnel: To set up the SSH tunnel to your VNC server on Katahdin you can run the ssh command in a Terminal (in Applications->Utilities). The command to run (remember, port 5919 is just used as an example here; check to see what your port is using the vnccheck command on katahdin) is:
ssh -L 5919:localhost:5919 firstname.lastname@example.org
This will set port 5919 on your machine to be connected to port 5919 on Katahdin. Port 5919 is our example port for your VNC Server running on Katahdin.
2. connect to the VNC server: Now all you need to do is open up Safari and enter the URL:
This should bring up your VNC Desktop.
3D Rendering with OpenGL (for now Katahdin does not have a GPU for rendering)
If you have a 3D program that uses OpenGL then run your program under vglrun in order to speed up graphics. In fact, you will probably get an error if you don’t. For example, to run a program like glxgears, ordinarily you would just type the command:
[cousins@katahdin ~]$ glxgears
Doing this would probably produce something like:
Xlib: extension “GLX” missing on display “:19.0”
To fix this, run the command with vglrun:
[cousins@katahdin ~]$ vglrun glxgears