Hack11.Access VNC Servers over the Web


Hack 11. Access VNC Servers over the Web

With a little extra software, you can access your VNC servers in any web browser.

If you use VNC often enough, you'll eventually find yourself needing access to a VNC viewer from a computer on which it has not been installed. You can put a copy of the installer or the installed application on a public share, but manually connecting each time is a pain, especially if you just need to quickly type a command or check status on the remote machine running your VNC serverand always carrying a CD or floppy with the VNC viewer application on it is equally irksome.

Fortunately, the people who designed VNC are smart folks, and they thought of a solution to the roaming user problema hassle-free way to make your VNC servers available even if the system you're using doesn't have VNC client software installed. All VNC servers include a small built-in web server that can serve the Java classes needed for any Java-enabled browser to connect to the VNC server. This lets you access any VNC session that is already running on one of your systems using any modern, Java-enabled browser. The VNC server listens for HTTP connections on port 5800 plus the number of the display being exported. Therefore, to view a VNC session running on display 1 of the host 64bit.vonhagen.org, you would access the URL http://64bit.vonhagen.org:5801/.

As with any VNC session, the Java classes that implement the VNC client will prompt you for the VNC server's password before connecting to the VNC server. Figure 2-3 shows a connection to my laptop's VNC server, on which I am running the Fluxbox window manager (http://fluxbox.sourceforge.net).

Figure 2-3. A VNC desktop in the Firefox web browser


2.3.1. Installing Java Classes and Associated Files for the VNC Server

To enable web access to your VNC server(s), you must install the Java class and JAR files, and a few additional files for the HTTP VNC server on the system where you'll be running it. These files are installed as part of both the RealVNC and TightVNC server packages, but they can also be obtained from the RealVNC and TightVNC web sites (http://www.realvnc.com and http://www.tightvnc.com, respectively) if they aren't installed on your system for some reason. Where they are installed and how you let the VNC server know about them depends on the version of the VNC server and the associated vncserver script that you're running.

If you're running TightVNC, the location where these files are found is specified in the variable $vncClasses in the vncserver script.

You must also make sure that the following line is not commented out of the vncserver script:

 $cmd .= " -httpd $vncClasses"; 

If you're running a RealVNC server, the location(s) where these files can be found is specified in the variable $vncJavaFiles in the vncserver script:

 $vncJavaFiles = (((-d "/usr/share/vnc/classes") && "/usr/share/vnc/classes") || ((-d "/usr/local/vnc/classes") && "/usr/local/vnc/classes")); 

You must also make sure that the following line is not commented out of the vncserver script:

 $cmd .= " -httpd $vncJavaFiles" if ($vncJavaFiles); 

Once you've configured the startup script for the Java and other files used by the VNC server, you should restart any VNC server(s) that you're currently running to ensure that they pick up the files used by the VNC server's mini-HTTPD daemon.

2.3.2. See Also

  • "Access Systems Remotely with VNC" [Hack #10]

  • http://www.tightvnc.com

  • http://www.realvnc.com



Linux Server Hacks (Vol. 2)
BSD Sockets Programming from a Multi-Language Perspective (Programming Series)
ISBN: N/A
EAN: 2147483647
Year: 2003
Pages: 162
Authors: M. Tim Jones

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net