Remote Control with VNC

Why go into the office when you can work from your living room? The Internet has made telecommuting to work from home a more popular option in corporate America. Certainly, if you are a Windows user, there's no lack of remote control applications for doing this, but Linux users may find themselves in a bit of a bind.








Desktop Windows Viewing LX
Looks Like Linux: Virtual Network Computing makes it possible to access your Linux system remotely from a Windows platform.

Why go into the office when you can work from your living room? The Internet has made telecommuting to work from home a more popular option in corporate America. Certainly, if you are a Windows user, there’s no lack of remote control applications for doing this, but Linux users may find themselves in a bit of a bind.

What if you’re at home and want to use a dial-up PPP connection or a Virtual Private Network (VPN) to access your desktop PC or server at work? Or, perhaps you’ve got a secondary computer in another part of your house or workplace that has an application on it that you need to run, but the machine isn’t easily accessible. What tools do you use?

On the Windows platform, there are a multitude of remote-control commercial products available, such as Norton PC Anywhere and CA ControlIT. There are also several thin-client remote application server platforms available, such as Citrix Metaframe and Windows 2000 Terminal Server, both of which are specifically designed for multi-user application hosting.

On Linux, we now have both SCO’s Tarantella and GraphOn’s Bridges, which allow you to run X and Microsoft Windows applications remotely and display them in your Web browser. However, these specialized application server setups can be expensive and are probably overkill for just standard remote console activities.

Certainly, you can also remotely execute X applications using XFree86 itself, but the X protocol requires a significant amount of network bandwidth to work well, and X doesn’t help very much if you want to control a Windows machine or a Mac remotely from a Linux box.

VNC To the Rescue!

For those of us who don’t have a ton of money to throw around for a sophisticated remote access and application server setup, there’s VNC (Virtual Network Computing). Developed by one of AT&T’s research laboratories in Europe, VNC is an open source, Free Software product that delivers high-performance remote console capabilities for Unix and Linux, as well as Microsoft Windows and the Macintosh. Cool, right?

VNC basically has two parts — a client application (vncviewer) and a server application (vncserver). The server is available for practically every variant of Unix as well as for Microsoft Windows and MacOS. Basically, you can connect from a Linux machine to a computer running a VNC server by using the native-compiled vncviewer for Linux (a special KDE 2.0 version named keystone exists as well, which is provided as part of the kdenetwork base distribution). The VNC server also offers a built-in Java Web interface that you can use to run applications remotely and to display their output in Netscape.

Getting And Installing VNC








Desktop Mac Viewing LX
Still Looks Like Linux: VNC is available for many different platforms, including Windows, MacOS (shown here), and many variants of Unix.

VNC is available directly from the VNC site at http://www.uk.research.att. com/vnc/download.html. At the time of this writing, the current version for Linux was 3.3.3 and the binary distribution file was named 3.3.3r1_x86_ linux_2.0.tgz. This contains both the VNC server and the VNC viewer for Linux. In addition to the Linux version, you’ll want to download versions of VNC for all the platforms that you are going to control remotely, such as Windows or another flavor of Unix.

We’re not going to cover installing the Windows or Macintosh VNC viewers and servers in the limited space of this column, simply because installing these is generally as easy as double clicking on the package and choosing the “Setup” option in the resultant dialog box. Hey InstallShield, please do not give up on Linux!

Once you’ve downloaded the Linux version of VNC, you’ll want to untar the files into a directory such as /home/ vnc and then copy the files vncserver,vncpasswd, vncviewer, and Xvnc to your /usr/bin directory. If you want to be able to remotely control your Linux computer via the VNC server’s integrated Java interface, you’ll also need to create the subdirectory /usr/local/vnc/classes. After creating this directory, copy the VNC Java .class files to it by executing the following commands:


# mkdir -p /usr/
local/vnc/classes
# cp classes/* /usr/
local/vnc/classes

Next, you will want to be sure the Perl scripting language is installed on your machine and that the Perl interpreter is located in /usr/bin/perl/. Chances are that it already is, but if it isn’t, you’ll need to modify the first line of the vncserver script to reflect its actual location.

Once you’ve done all this, you can start your VNC server by issuing the following command from a terminal window:


# vncserver

You’ll be asked to set a password for the server, and then the script will display a message indicating the server was started on display:1. What does this mean? Well, on Unix systems, the VNC server (vncserver) program is actually implemented as its own special X server, which instead of displaying output to your screen, displays it over the network to the vncviewer program. Since, by default, your X server displays its output to display:0 (otherwise known as your monitor), VNC will start its own X server on the next available port (:1).








Desktop LX Viewing Windows
Homework: VNC can solve your telecommuting problems by letting you access your Windows machine at work from your Linux box at home.

Because VNC has its own dedicated X server, it also has its own set of window manager settings. The FAQ on the VNC Web site contains additional information on configuring the remote window manager. By default, VNC is set to use the twm window manager, which is extremely minimalist. The settings for the default window manager are stored in a file called xstartup that is located in a hidden subdirectory named .vnc, located in your home directory.

Twm may be minimalist, but gener-ally speaking, you probably don’t want to run KDE or GNOME over a remote connection. Those environments consume a considerable amount of system resources and wouldn’t be too easy on the network. One light, but feature-rich, window manager that we liked for remote X sessions was fvwm2, which can be obtained from http:// www.fvwm.org.

To test that your VNC server is running properly, you can run vncviewer xxx.xxx.xxx.xxx:1 where xxx.xxx.xxx. xxx is your computer’s IP address or hostname, and the :1 refers to the X display session. If you installed the Java classes, you can also connect to the vncserver by launching Netscape (or Microsoft Internet Explorer, if you want to remotely connect to it via a Windows machine) and entering the following URL: http://xxx. xxx.xxx.xxx:5801. Again, xxx.xxx.xxx.xxx is your computer’s IP address or host name.

The vncviewer Java applet should load in your browser, and you’ll be prompted to enter the server password that you set earlier.

If you want to control a Macintosh or a Windows machine remotely, keep in mind that those systems only have one default display. Therefore, you will want to connect to them using port 5800.

When using the various GUI viewers for different platforms, keep in mind that, by default, the viewer initiates its session using 16-bit (65,535) color depth. If you’re controlling systems on an Ethernet LAN, you probably won’t see serious performance degradation. However, over the Internet the overhead of streaming extended color data can really bog you down.

If you’re connecting to the Internet, you’ll probably want to connect using 8-bit color. To do this using the native Linux client, simply issue the following command to connect to a VNC server at 8-bit (256) colors:


# vncviewer
xxx.xxx.xxx.xxx:1 bgr233

The -bgr233 option means “tell the server to send the pixels in an 8-bit true color pixel format, with the most significant two bits of each byte representing the blue component, the next three bits representing green, and the least significant three representing red.” I thought that you might need this little bit of geek trivia for the next time that you’re in the hot seat with Regis! Not.

So, now you know the basics of Virtual Network Computing. It’s incredibly easy with VNC to remotely control your server or desktop at work from your Linux machine at home. If you want to get really crazy, you can even do it from your PalmPilot or Windows CE handheld using a wireless modem. In fact, it’s even possible to use VNC from certain kinds of cell phones, as the viewer has been ported to all kinds of weird machines.

Maybe if I’m lucky, someday they will port a remote control server to the MotherInLaw and AnnoyingBoss platforms… But that’s probably asking for way too much.




Web Links


For more information on commercial remote control applications for Linux:


GraphOn Bridges




SCO Tarantella




For more information on VNC:





Jason Perlow is a freelance writer and systems integrator. He can be reached at perlow@hotmail.com.

Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62