FreeOS.com logo

FreeOS Most Popular
* Most Read stories
* Commented Stories
* Active Categories
* Non Linux Section
* User Submitters
* Top Polls
* Top Authors
* Top Reviews
* Top Rated
* Top Search Terms

Top Articles
* Writing a Linux device driver
* The Linux filesystem explained
* Samba NT Domain Controller
* Setting up Squid as your caching HTTP/FTP proxy
* Web server tutorial - Part 1

FreeOS Highlights
* Howtos (72)
* Reviews (20)
* Opinions (18)
* Interviews (8)
* News (3)

My FreeOS

Nick:
Pass:
Register

Forgot your password?

Contact Us
Contact Us

       

Project: Linux triangle Howtos triangle

Remote desktop using VNC

By Mayank Sarup <mayank@freeos.com>
Posted: ( 2001-01-17 10:12:25 EST by )

X-terminals allowed you to work off another machine while sitting on your machine. VNC allows you to do the same and also adds the ability to go beyond your local network to access a desktop over the Internet. Use it from your Windows machine to access and administer your Linux box or even the other way round!

The concept of a remote desktop is very common among Unix networks. The design of the X server allows you to sit at one machine and work on another and access the entire range of GUI applications. The trouble, however, with the X-terminal setup is the high bandwidth connection that is required, restricting their usage to a local network. In contrast, VNC (Virtual Network Computing) offers the same functionality but will work over low-bandwidth connections too. VNC will even work over the Internet.

Several platforms and architectures are supported. Servers and clients are available for Linux, Windows, Solaris, Macintosh and even Windows CE. These are all available under the GPL. You can even use a browser that supports Java to connect to the remote desktop!

Where?

You will find clients and servers for all the available platforms at http://www.uk.research.att.com/vnc/download.html. Also check the available documentation at http://www.uk.research.att.com/vnc/docs.html. Perl should be installed on your system.

Installation

Installation of the Windows version is as difficult as the unpacking the archive and clicking on setup.exe. The Linux install is just as easy. We'll be working with the Linux version here.

We are using VNC 3.3.3r2 here. The archive is vnc-3.3.3r2_x86_linux_2.0.tgz. Unpack this archive somewhere (/tmp). Enter the directory vnc_x86_linux_2.0 that is created. Copy the files vncviewer, vncserver, vncpasswd and Xvnc to a directory accessible by non-privileged users too. You don't have to be root to start a server and you definitely shouldn't start one as root. Anyone connecting to a server started as root will also have root privileges.

cp vncviewer vncserver vncpasswd Xvnc /usr/local/bin

There is also a Java viewer that allows you to connect to the VNC server using any Java-capable browser.

mkdir -p /usr/local/vnc/classes

cp classes/* /usr/local/vnc/classes

Configuration

That was the installation. Before you start VNC though, some configuration changes are to be made.

Open the file vncserver. This is a perl script and the first line of this script might have to be modified. #!/usr/bin/perl is the default path set. Do a "which perl" to check where perl is installed.

To start a VNC server simply run the script vncserver. Unless there are problems, you will see the following.

New 'X' desktop is vncserv:1

Starting applications specified in /home/freeos/.vnc/xstartup
Log file is /home/freeos/.vnc/vncserv:1.log

If this is the first time you are running vncserver, you will be prompted for a password. This password will be used when accessing your vncservers. Use vncpasswd to change this password at a later date.

":1" here means that the server has been started on display 1. Vncserver will take up the first available display. To start vncserver on a specific display, use "vncserver :[display-number]".

vncserver :3

Now, let's connect to the server and check whether it is accessible. While in X, open a Xterm window and run vncviewer.

vncviewer [server]:[display]

vncviewer freeos:1

You can use hostnames or IP addresses here. Do not forget to include the display number to connect to. There can be multiple desktops running on separate displays so you should specify the one you want to connect to. Enter the password to connect with. If correct you will be looking at a desktop in a window.

By default VNC uses the twm window manger but this can easily be modified to your liking. Open the file $HOME/.vnc/xstartup in a editor. Look for "twm &" and modify that to run the window manger of your liking. Our choice was Windowmaker for which we modified the line to "wmaker &". KDE user may want to user "startkde &" here. You can also place any other commands here that you might want to run at startup. To stop a server use "vncserver -kill :display".

vncserver -kill :1 will kill the display running on 1.

Start a new server, connect to it and you will now see your favorite window manager pop-up. You can have more than one server running. Now open any application and work as you would on your own desktop. Now for a little experiment. Don't shutdown any of the running applications but close the window that contains your remote desktop. Don't worry. You're about to see one very cool feature of VNC. Start vncviewer and connect to the same server and display. Your desktop will still be as you left it! Barring the server going down or your application seg-faulting, you will still see your desktop as you left it. You can connect from any other machine on the network or over the Internet and still continue where you left off.

Speaking of the Internet, the Java viewer that VNC provides does come in handy if you have a Java browser but not a viewer. Simply connect to http://server:5800+display-number to open the desktop within your browser. To connect to 192.168.1.23 and display 2, use the following.

http://192.168.1.23:5802 or http://freeos:5802

Enter your password as before and you will be looking at your desktop.

As you can see, VNC is an excellent tool for accessing your desktop remotely. Be creative. There's always going to be a better way of using VNC. Remote administration is a possibility but that has more value on the Windows platform. Linux can be maintained right off the command line. Where VNC really shines is by giving you so many choices of accessing your desktop. Collaborative working is also a possibility with many users working on a desktop. This application is definitely a keeper.

VNC home
Guide to X-terminal setup

Other articles by Mayank Sarup

Current Rating: [ 7.38 / 10 ] Number of Times Rated: [ 106 ]

More Howtos
* Kernel Compilation & Avoiding ‘Unresolved Symbol’
* Configuring CVS and CVSUP on Linux
* Knoppix installation tips
* Maximum Mount
* A WebServer Guide -- Help Using Apache

Contents
Articles
  Howtos
  Interviews
  News
  Opinions
  Reviews
Comparison
Links
  Articles
  Howtos
  Interviews
  Opinions
  Reviews
  Websites
News

Linux
About Linux

Print It!
Printer Friendly Version