VNC

In order to remotely access your Linux desktop, it is possible to use VNC. This is analogous to the "Remote Desktop" feature of Windows, and is also an alternative to Exceed.

While we do not directly support VNC, it is important to be aware of the security implications. Out of the box it is not very secure for it will send your password and data unencrypted over the network. Therefore, please follow the steps below to make sure that your access is secure:

Using VNC from a Windows host machine

To access a remote Linux system from a Windows host machine, we need the following programs:

  • Putty, installed by default on all our Windows systems
  • RealVNC viewer; note that this is not a regular Windows installer, but simply an executable that you can copy anywhere.

Setting up a VNC server

Once both programs are on the machine that you want to use, proceed as follows:

  • Start putty
  • Enter the details of the remote host that you want to access (ngrid12.win.tue.nl in this example):
  • In the sidebar of putty, open the Connection item, then open the SSH subitem, and click on Tunnels.
  • Enter the correct portnumber (explained below) in the Source port box, 5910 in the example.
  • Enter localhost:portnumber in the Destination box.
  • Click on Add. Your port will now be listed in the Forwarded ports box in the middle:
  • In the sidebar of putty, go back to the first item called Session, and enter a name in the box just below Saved Sessions. Then click on Save. From now on, if you want to connect to the same host with VNC, you can select the saved session from the list and click Load.
  • Next, click Open at the bottom of the putty window.
  • If this is the first time that you connect to this host, putty will prompt you whether you want to verify the host key. Accept this.
  • A terminal window will open. If this is the first time that you are running VNC, you first need to set a password by typing vncpasswd and entering a made-up password twice.
  • To start your remote session, type:
    vncserver :10 -localhost
    This will start a VNC server on display 10. It is possible that display 10 is already in use. In that case, you can simply choose another free number, but note that you need to change the portnumber in putty as well.
  • You are done in the putty window, it should look somewhat like the screenshot below. Note that you need to keep this window open for the VNC connection to work!
  • Now start the downloaded RealVNC executable. Enter localhost:10 (substituting the correct port number).
  • RealVNC will ask for your password that you set up with vncpasswd. Enter this and click OK.
  • You are now connected!

Note that you can close both putty and RealVNC, and the VNC server processes will keep running.

Reconnect to a VNC server

To reconnect, connect with Putty again but do not run any commands. When putty is connected, start RealVNC again and it will reconnect to your session.

Logging off

To correctly shut down the VNC session, you need to close the RealVNC window. Then enter the following command in your putty window:
vncserver -kill :10
Substitute the correct port number where necessary.

Using VNC from a Linux host machine

The necessary programs to make a VNC connection are usually installed on most modern Linux systems already. You need ssh and a version of VNC; Fedora uses TigerVNC by default.

Use the following steps to start a remote desktop session:

  • Set up a secure connection with SSH, opening a tunnel to the remote system:
    ssh -L 5910:localhost:5910 user@host
    Please use the correct portnumber (explained below).
  • If this is the first time that you are running VNC, you first need to set a password by typing vncpasswd and entering a made-up password twice.
  • Start the VNC server using the following command:
    vncserver :10 -localhost
    Note the display number (10) which matches the port number.
  • On your local Linux system, start the VNC software (either from a graphic menu or the terminal).
  • Enter localhost:10 as the host to connect to (again minding the display number corresponding to the port number).
  • You will now be connected!

Note that you can close the VNC window as well as terminate the SSH command, and your session will keep running.

Reconnect to a VNC server

To reconnect, connect with SSH again but do not run any commands. Simply start your VNC client on the local machine again and it will reconnect to your session.

Logging off

To correctly shut down the VNC session, you need to close your VNC client window. Then enter the following command in your SSH connection:
vncserver -kill :10
Substitute the correct port number where necessary.

The port number 59XX

The port number for VNC depends on the display number of the VNC server; it is 5900 + display. Therefore, if display :10 as used in the examples above is already busy, you need to allocate another display number, and therefore you need to tunnel another port. Be sure to substitute the correct display and port numbers where necessary.


Contact us | Webmaster

Questions? Mail to helpdesk.win@tue.nl