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.

The VNC server

On the Linux system that you want to access remotely, do the following:
  • If you haven't run VNC before, first create the configuration file as described below.
  • Start the VNC server on the machine you wish to access. Make sure that you specify the -localhost parameter to only allow local connections!

    [wshelp@antilope ~] $ vncserver :10 -localhost

    If this is the first time that you run VNC, you will need to set a password for connections:

    You will require a password to access your desktops.

    Password: enter a password
    Verify: enter the same password

    New 'antilope:10 (wshelp)' desktop is antilope:10

    Starting applications specified in /home/wshelp/.vnc/xstartup
    Log file is /home/wshelp/.vnc/antilope:10.log

The VNC client on a Linux system

On a Linux system from which you want to access the VNC server:
  • Setup a secure connection using ssh:

    [wshelp@pclin107 ~] $ ssh -N -L 5910:127.0.0.1:5910 wshelp@antilope wshelp@antilope's password: enter your password

    You can now put the ssh program in the background by entering control+z, and then bg.

  • Finally, start the viewer program on your desktop machine:

    [wshelp@pclin107 ~] $ vncviewer localhost:10

    Enter the VNC password that you set for the VNC server.
Remember to kill the ssh program if you do not need the connection anymore.

The VNC client on a Windows system

Basically you need to follow the same steps as on a Linux VNC client system:
  • Use a SSH program to setup a secure connection. You can start one of:
    • ssh2.exe provided with SSH Secure Shell
    • putty.exe provided with putty
    from a cmd session and apply the same options.
  • Several VNC implementations exist that will allow you to connect to display number 10 on the local host.

The port number 59XX

The port number for the ssh command line depends on the display number of the VNC server; it is 5900 + display. Therefore, if display :10 is already busy, you need to allocate another display number, and therefore you need to tunnel another port.

Setup

Before running VNC for the first time, you need to create the ~/.vnc/xstartup file. It needs to contain the following lines:

#!/bin/sh
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

The file also needs to be executable:

$ chmod a+x ~/.vnc/xstartup

Note that the exit or logout menu of the KDE or Gnome session will not really exit and leave a lot of dangling processes on the server. You need to kill the VNC server manually.

Setup for short and simple sessions

If you only need a simple session, a window manager like wmaker in ~/.vnc/xstartup will leave less dangling processes in case you leave trough its menu :

#!/bin/sh
unset SESSION_MANAGER
exec /usr/bin/wmaker

and to also kill the VNC server automatically if you leave through the window manager menu:

#!/bin/sh
unset SESSION_MANAGER
/usr/bin/wmaker
vncserver -kill $DISPLAY

Contact us | Webmaster

Questions? Mail to wshelp@win.tue.nl