↑ Return to Documentation

Connect by VNC

For now, Marconi has some visualization capability (Matlab, ncview, etc.) and VNC is a good way to be able to use that capability. In the near future the Viz server will be brought over to the new cluster to take over this role.

It is possible to connect to the system securely using VNC with the help of SSH. Since Marconi 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: Two components

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 Marconi

The first thing to do is to set up the VNC server on Marconi. To do this, first ssh in to your account and run the command:

vncserver

First time:

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:

-bash-3.2$ vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth:  creating new authority file /home/guest/.Xauthority

New ‘marconi:19 (guest)’ desktop is marconi:19

Creating default startup script /home/guest/.vnc/xstartup
Starting applications specified in /home/guest/.vnc/xstartup
Log file is /home/guest/.vnc/marconi: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.

 

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:

Linux vncviewer:

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 username@marconi.clusters.umaine.edu :19

where “username” is your account name and you would substitute your display number for :19. It will first ssh into Marconi (asking for your Marconi 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 Marconi. Once you login a window should pop up that is your Marconi desktop session.

 

Windows vncviewer:

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 Marconi 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:

  1. Bring up PuTTY and load the Saved Session that you use for connecting to Marconi (highlight the session and hit the “Load” button).
  2. In the left-hand window click on the “plus” sign next to the “SSH” option under Connection. Then click on “Tunnels”
  3. 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.
  4. 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.
  5. (optional) In the left box click on the “SSH” item and check the box that says “Enable compression” to improve performance.
  6. In the left box of the Putty Configuration window go all the way to the top and click on the “Session” item. In 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 Marconi as usual but it will also be setting up an encrypted “tunnel” from port 5919 on Marconi 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 Marconi you need to make sure that you connect to Marconi with PuTTY using this Saved Session first.

 

Running vnciewer on your machine:

  1. First make sure that you have logged into Marconi with the saved session that you created above that sets up the tunnel.
  2. 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/
  3. 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 Marconi.
  4. Hit the “Connect” button and login with the password that you set up when you ran the vncserver program on Marconi.

At this point the Linux Desktop from Marconi should appear in a window.

 

For Mac users, the concept is the same. I will try to find a Mac to get the details. If someone has the details, let me know and I’ll update this section.