Linux.com

Home Learn Linux Linux Tutorials VNC: Virtually there and back again

VNC: Virtually there and back again

Most people who are used to a Unix-style environment know that a machine can be reached over the network at the shell level using utilities like telnet or ssh. And some people realize that X Windows output can be redirected back to the client workstation. But many people don't realize that it is easy to use an entire desktop over the network.

VNC is inherently a client-server technology. On the remote machine, the server software is started. It is the job of this software to serve up the machine's desktop to the network. On a different machine, the client software resides. Someone sitting at the latter machine can use the VNC client to connect to the VNC server and see the full desktop of the remote machine. VNC communicates over the AT&T-developed Remote Framebuffer (RFB) protocol on multiple operating systems, including Windows.

Because the protocol involved is open, you can use it to contact a Windows server from a Linux client, or view an OS/2 server from NetBSD, or use a remote MacOS desktop from your VMS machine. All you need are the appropriate client and server software pieces installed and running on the platforms of your choice.

This software resembles popular PC programs like pcAnywhere and CarbonCopy. The client can use the server's desktop, move the mouse, type into text boxes, and click on icons. This can be just the ticket for a support person who needs to help a user in trouble. The support person can examine the PC's configuration remotely or demonstrate how to do a particular task while the user watches how it is done. Because they are sharing the desktop, each can take turns doing things to resolve the issue.

Another option allows the remote user to access the desktop in view-only mode. This allows monitoring of the desktop without interference, which could be very useful for demonstration purposes. The experience can even be shared by multiple remote users.

Accessing Linux from Windows ME
Figure 1: Accessing Linux from Windows ME

But the fun doesn't end there. Since the client and server programs are all interchangeable, special purpose variants are also possible. Take, for example, the fact that Linux and Unix-like operating systems are not restricted to the concept of a single desktop for a single machine. There are VNC servers that do not seize the current user's desktop, but instead create their own. Instead of providing functionality based on sharing the desktop with another user, this style of VNC server allows multiple people to simultaneously work on different desktops on the same machine at the same time.

What about security? Running a client-server combo over a LAN may be fine, but how could you do this in a potentially dangerous network environment like the Internet? Thankfully, the connection can also be established over an ssh link. By using the secure shell, there is no need to leave a port open on the server for crackers to exploit.

And, to top it all off, most VNC kits tend to be very compact. You can easily place the kits for client and server on a single floppy, making it a great addition to a techie's support bag.

So what are my choices?

You can download VNC from the original AT&T site or RealVNC. Both sites offer GPL software for Linux, Solaris, Windows, and other platforms, and even give information on getting enterprise support for using VNC.

I found heXoNet's x0rfbserver and xrfbviewer, a server and client that use the RFB protocol, installed by default on my Mandrake. The server program, x0rfbserver, allows remote access to the current desktop. It also allows the desktop to be shared by remote users and can allow access in a view-only mode. Simply start the program and the server is online -- no elaborate configuration needed.

The client program, xrfbviewer, is a simple yet effective VNC viewer. Start the program, enter the domain name or IP address of the machine running the server, enter a password if the server requires it, and bingo -- you're there. It also has the nice capability of being able to record your sessions into a local file, where they can be played back using the xplayfbs program. Unfortunately, I was never able to get playback to work correctly. After installing some icons that weren't included in the Mandrake install I was finally able to record, but xplayfbs refused to display anything other than a blank screen on playback.

Another very popular package is TightVNC's vncviewer and vncserver (the latter acting as a wrapper for Xvnc). TightVNC is available on Linux, Unix, and Windows, and even has a Java-based viewer. It is an enhanced version of the original AT&T VNC software, so it is both fully compatible with and has more features than the original.

Using vncviewer and vncserver is no harder than using the heXoNet equivalents, but the TightVNC variants offer a large array of optional compression settings that neither the original AT&T VNC utilities nor the heXoNet utilities have. This allows users to tune connections to the quality of the network link. Compression can make VNC more usable when a couple of fast machines are connected by a slow network.

The biggest difference between heXoNet and TightVNC is on the server end. The x0rfbserver sets up a VNC server that allows remote users to control the desktop while maintaining the local monitor screen. When a remote user moves the mouse or types in a window, the local user of that desktop sees it as well. But vncserver creates a new desktop in memory and allows the remote user to have full control of that desktop without interfering with a local user who might be doing other tasks. What's more, since it can produce a number of these desktops, multiple remote users can use the same system simultaneously independent of one another.

Unfortunately, these innovations are not available in WinVNC, TightVNC's Windows software. Windows is much more wed to the concept of one desktop per machine than Linux and Unix are.

Accessing Windows ME from Linux
Figure 2: Accessing Windows ME from Linux

But there's one more surprise on the server end: a miniature Web server. When you connect to a TightVNC server using a Web browser, the server automatically sends the client a Java applet and allows you to use the remote desktop from the browser. That can be quite a useful option in many situations.

TightVNC is easy to run over an ssh connection as well. Simply enable incoming X Window traffic on the client machine using the xhost command. Use ssh to log in to the remote system. Set the DISPLAY variable to point back to the client machine (if it is not set automatically). Run vncserver on the remote box to set up the desktop. Then run vncviewer on the remote system and the X Window output of the server appears on the local box. While it can run slowly depending on the link, it does the job and keeps vncserver from needing to open itself to the outside world.

There are many VNC programs on other platforms available as well, including fbvncserver for Sharp's Zaurus PDA. Installing that (and zlib, which it uses for compression) allows me to run a VNC session from my desktop Linux machine to my Zaurus SL-5500. Using my PC keyboard and mouse to manipulate the Zaurus is a real time saver. And watching my PDA seemingly moving about on its own while generating keyclick sounds is a kick, too.

In addition to the basic VNC software there are also user-friendly front-ends to enable many of the software's options. Mandrake has been shipping rfbdrake to do just that, and the latest version of KDE now includes KDE Desktop Sharing, which does about the same thing.

I know several people who use VNC regularly and love it. But I know even more people who have never even seen it in action. If you ever need to access computers remotely, I suggest giving this a simple and useful tool a try.

Russell Pavlicek is a consultant and author dealing with Linux in business. He is a panelist on The Linux Show weekly webcast, and is a contributor to a number of Linux Web sites. He formerly wrote the Open Source column for InfoWorld magazine.

 

Comments

Subscribe to Comments Feed

Upcoming Linux Foundation Courses

  1. LFS230 Linux Network Management
    06 Oct » 09 Oct - Virtual
    Details
  2. LFS416 Linux Security
    06 Oct » 09 Oct - Washington
    Details
  3. LFD331 Developing Linux Device Drivers
    13 Oct » 17 Oct - Virtual
    Details

View All Upcoming Courses

Become an Individual Member
Check out the Friday Funnies

Sign Up For the Linux.com Newsletter


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board