VNC redirection

If you log on to a Linux computer via the net and want to use programs with a graphical user interface (such as kprinter), you need a screen redirection. From a Linux computer you can simply use ssh -X, then graphical programs should start normally.

When logging in from a Windows machine, you can help yourself like this:

Start VNC server

On the server start a new X server with

vncserver -query localhost

This will return a message of the form

New 'X' desktop is host:1

or similar, where the "1" is the number of the X server, it can change. This should be remembered. Often it is useful to reduce the size of the redirected screen by using something like

vncserver -query localhost -geometry 800x600

Also, you can use the -once option to instruct the server to run for only one session and then shut down automatically. The first time you run vncserver you will be asked for a password. This is needed later to access the server. It does not have to be the user password. To change the password, delete the file

~/.vnc/passwd

Then you have to enter a new one at the next start.

Establish SSH tunnel

On the Windows client, start an SSH connection to the server with PuTTY, i.e. start PuTTY, select host and port 22. Additionally two ports have to be tunneled. This can be done like this:

  • Select "Connection/SSH/Tunnels" in the menu on the left.
  • Source port: 5801
  • Destination: rechner.math.tu-clausthal.de:5801
  • and click Add, then the same with 5901.
  • <it>The last digit must correspond to the number of the X server (see above)!</it>
  • Select "Open" and log in with ID and password.

View in browser

Start WWW browser and enter as URL

http://localhost:5801

(adjust last digit again). A Java display of the screen redirection is running. The image content is transferred as JPEG, therefore not very fast. Within the math institute this is sufficient for most programs, but you probably don't want to work with it permanently.

View with Viewer

Here it is best to use TightVNC. If the SSH tunnel is established, simply start the program and give it the display number of the VNC server (see above, for example localhost:1). Now you can adjust the options, especially regarding compression of the data. After that the viewer only asks for the VNC password stored on the server and you are ready to go.

Exit

  • client: quit browser/viewer
  • server: kill vncserver with
    vncserver -kill :1
  • (omitted with option -once)
  • client: terminate SSH connection/PuTTY.