Aerospace



Home

Company Information

Information Request

Linux How-to Guides

ADSP 21xx
Digital Signal Processing
Tutorials

SW Utilities

On-line Order Form

Aerospace Projects

Commercial Projects

Circuit Boards

Server Support


Bonk

Have you found this site useful? Did we save you time? Did we cure your head-ache? Is your hair growing back now?

Please make a donation to help with maintenance.


TightVNC Howto

VNC is a powerful Client Server application to help you control any kind of machine from any other kind of machine. If you run a VNC server on a MS Windows box, then you can get full remote control from a GNU/Linux box and vice versa, using nothing more than a web browser as the client application.

Together with Mandrake Move CDROMs, TightVNC could make a nice system for use in a school, call centre or internet cafe.

TightVNC is extremely easy to set up and use. You can have it up and running in 15 minutes. The VNC documentation is good and is all you need, if you know where to get it, but there are a few things that are not obvious. The very first time I tried VNC, I spent many happy hours experimenting, reading and re-reading documents.

This guide concentrates on Mandrake Linux, but the gist of it applies to any VNC setup and should help you get going no matter what system you are using.


Where to get it

TightVNC is one of the better VNC systems and you can get it here: http://www.tightvnc.org.

Note that Mandrake Linux has TightVNC on the CDROMs. Use urpmi or the software install wizard to install vnc-client and vnc-server. Click Start, System, Configuration, Configure your computer, Software Management, Install and select tightvnc and tightvnc-server.

The only drawback to TightVNC is that it doesn't encrypt the tunnel, but you can use SSH to do that if you need to.

TightVNC includes both server and client software for Windows and Linux, but you may also want to experiment using a web browser as a client. To do that, you can get the Firefox browser here: http://www.getfirefox.com.

In addition to a good browser, you will also need a Java Plugin, which you can get here: http://plugindoc.mozdev.org /linux.html and the FAQ is here: http://plugindoc.mozdev.org/fa qs/java.html.

Getting the Java plugin to work in Firefox is a bit of an adventure. You will probably need to do some FAQ reading and Googling. If Firefox crashes the moment you start it, then you are using a bad plugin - the plugin download has 3 versions (something like NC6, NC710 and NC710-C32). Keep trying till you find one that works - you should probably use the 32 bit one.

The TightVNC Client is easy to install and generally works better than a browser, but give them all a try while you are at it.


VNC Server

Obviously, you need to run a VNC server on the target machine and use a client on the remote machine. Furthermore and this not clear from the documentation, you need to run the server as the user that you want to control, but you need not run X. VNC has its own X Windowing System built in.

In the home directory of the user that you want to control remotely, put this little script called vncstart:

#! /bin/bash
# HTTP connect to port 5800 + display number
# RFB connect to port 5900 + display number
# 1024x768 display size assumed
vncserver :2 -geometry 1018x706 -depth 24

Make the script executable:

# chmod 750 vncstart

For good measure, also make a script to stop vnc called vncstop

#! /bin/bash
# HTTP connect to port 5800 + display number
# RFB connect to port 5900 + display number
# 1024x768 display size assumed
vncserver -kill :2

Make that one executable as well:/

# chmod 750 vncstop

The first time you start the server, it will ask for a set of passwords. These are the passwords that the client will prompt for when you try to connect later. Run ./vncstart and enter the passwords.


Explanation of VNC Server Parameters

We can safely assume that the machine already is using a X screen, which will have the number 1. When we run the server, it is prudent to assign the next free screen number 2. That is the :2 in the command line.

The most common screen size nowadays is a 17inch monitor with 1024 by 768 pixels. If we want to display the screen on the remote machine without causing scrolling problems, we need to configure the VNC screen geometry slightly smaller than this, to allow for the menu bar and borders. A good geometry therefore is 1018 by 706.

The depth parameter is the number of bits of colour. Too much colour and things will be slow. Too little and the remote screen will look bad. Sixteen or 24 bits of colour depth should work OK.


Port Numbers

VNC uses two ports. Since you can run multiple sessions and remote control many users at the same time, the system uses a base number and add the screen number to that. The two base port numbers are 5800 and 5900.

In this case, we need to ensure that ports 5802 and 5902 are open in the firewall, so we can connect to the server machine.


The VNC Client

Running the client is easy as pie, if you know how to input the address...

Click Start, Internet, Remote Access, TightVNC. This will launch the client and it will show a tiny box asking for the address. You need to enter the IP address and the screen number:

111.222.333.444:2

or, if DNS is working:

host.name.tld:2

The client will then prompt you for the password and you will get a fully functional remote desktop.

La Voila!


A Browser Client

If you have a Java capable Browser, then enter the address as follows:

http://111.222.333.444:5802

Or if DNS is working:

http://host.name.tld:5802

Note that you have to specify the port as base port + display number.

Even though you only specify port 5802, VNC uses port 5902 as well for remote procedure calls. Both ports must be open in the firewalls for this to work.


Multiple Users using Mandrake Move CDROMs

VNC can be used to serve multiple users, in which case, you need to run multiple servers, one for each user, each using a different display number. You then have to ensure that all the relevant ports are open (base ports + display number).

If two remote users connect to the same server ports, then they both control the same session. This can be useful for training and remote support. The support agent can see everything on the user desktop and can do things things right before the eyes of the user.

You can use one fast server and serve say 20 VNC sessions to a bunch of low power remote machines, each only running a client. You can run the server and client full screen with no borders and then the users will be oblivious to the whole idea.

For a school, call centre or internet cafe, a CDROM Linux version, such as Mandrake Move will be a zero effort method to connect to the server. The remote machines need not even have hard disks. This is much easier to configure and get going than a Terminal Server system, but you do need more powerful machines, which is not really an issue nowadays. The advantage of booting off a CDROM is that the users cannot break the work stations, no matter how hard they try, unless they chew and swallow the disks maybe.


Multiple VNC Servers

How do you go about running multiple VNC Servers?

Firstly, the server machine need not run the X Windowing System at all - VNC will run its own X implementation for each user, but you need X in order to configure each user a desktop with KDE.

Therefore begin by installing Mandrake Linux and configure all the users you want to have. Create them KDE desktops and set them up the way they should be, then log out. You don't need to have X running - it will just slow things down a little more.

However, you first have to decide whether you want to run VNC as a true multi user system or simply serve up multiple instances of the same user space. This may sound a bit confusing, but VNC is very flexible.

You run VNC Server as the user that you want to serve up, but if you run multiple instances of VNC as the same user (each with a different screen number), then the desktops will be independent, even though they use the same user space. This is somewhat like having 'multiple users' on a Windows98 system.

Alternatively, you can create multiple users on the Linux machine and run one instance of the VNC Server for each user. In this case, the users will be truly independent.

Therefore, in a school system, you can cheat and configure only one Unix user per class, to allow a class to easily share documents and run 30 instances of the VNC Server, each with a different screen number. Think about it before your do this, since it may create more problems than it solves, but it may cut down on VNC administration.

Automating the server startup is a problem due to all the user switching required. You can create a script as root and use sudo to launch the VNC Server, but then the stupid thing may complain: vncserver: Could not create /root/.vnc.

For example, this doesn't work, but is a step in the right direction:

#! /bin/bash
sudo -u tom vncserver :2 -geometry 1024x768 -depth 16
sudo -u dick vncserver :3 -geometry 1024x768 -depth 16
sudo -u harry vncserver :4 -geometry 1024x768 -depth 16

What you need to do is tell sudo to set the HOME environment variable to point to the home directory of the user. The -H parameter accomplishes that:

#! .bin/bash
sudo -u tom -H vncserver :2 -geometry 1024x768 -depth 16
sudo -u dick -H vncserver :3 -geometry 1024x768 -depth 16
sudo -u harry -H vncserver :4 -geometry 1024x768 -depth 16
...

Rinse and repeat for each user. In a school, I'll dispense with names and assign the children numbers - easier to set up 1500 kids that way, especially if you have no idea who is going to show up and the system needs to be working before the school commences.

Note that VNC can automatically assign the next free screen number, but then you are never quite sure who is who, so I prefer numbering the screens explicitly.


Fuzzy Fonts Fix

If the fonts look fuzzy on the remote desktops, then you forgot to enable anti-aliasing with sub pixel hinting on the desktops.

On each KDE desktop, go to Start, System, Configuration, Configure Your Desktop, LookNFeel, Fonts and enable Anti-aliasing and Sub Pixel Hinting RGB and Exclude the range 0 to 9 points. At very small type sizes, it makes things worse rather than better, therefore the exclude range.


Configuring many users the exact same way

OK, so you really need to configure 1500 kids all the same way and you really don't wish to log in 1500 times and configure KDE do you? The secret is the '/etc/skel' directory.

Create a user called 'template' with password 'template' and log in. Configure KDE the way it needs to be. Now copy the whole '/home/template/.kde' directory to '/etc/skel'. From now on, whenever you make a new user, it will get an identical KDE setup as the 'template' user. In fact, anything you put in the skeleton directory, will be copied to the user home directory - neat!


'Hope this helps!
Herman



Copyright © 2005-2008, Aerospace Software Ltd., GPL.