VNC

From LQWiki
Jump to navigation Jump to search

VNC stands for Virtual Network Computing. It is client/server software that allows you to build up a terminal server scenario. That means you have one central server where users can work on while using their local computers just to display the content that comes from the server.

It is possible that, say 5, users work simultaneously on one server, each of them using their client software on a different operating system.

It is also possible to view the local session remotely over VNC, using x11vnc.

Setup

Generic

VNC server is easy to install on Windows and on Linux. See also rdesktop for a way to log into windows native remote systems.

For the vncserver box, you don't need to start Xserver, VNC (TightVNC) incorporate one. It's start the window manager which is configured in the $HOME/.vnc/xstartup file.

To start a vnc server, open A Console and enter:

vncserver :X

at the prompt. Where X is the display's number where you want vncserver reside. The second part of VNC is the client. You can invoke it from the command line and, as a java applet, from a browser.

This means you can launch differents vncserver on differents ports and you access them by entering in web java browser : http://your_vncserver:58xx. Where xx is the screen (01 for "#vncserver :1", 02 for "#vncserver :2", "#...).

Distribution-specific

Mandriva

Server

1) Using either urpmi or menu->System->Configuration->Packaging->Install Software install tightvnc-server

2) Edit the file /etc/sysconfig/vncservers and add a line like this: Code:

VNCSERVERS="1:yourusername"

3) Logged in as yourself run 'vncpasswd' (no quotes) and set a password for your vnc desktop

4) Create the file .wmrc in your home directory and add a single line with either KDE or GNOME

5) Start the vncserver service with 'service vncserver start' OR in the Mandrake Control Centre->System->Services

Now you should be able to login to a vncserver on <ip of machine>:1

Client

Mandriva comes with a simple VNC viewer installed by default in menu->Internet->Remote Access, however the graphical parts of its user interface are a bit primitive and unfriendly. Using urpmi or menu->System->Configuration->Packaging->Install Software install the package krdc to get a more userfriendly VNC (and RDP) client.

VNC Usage

Commands

The client software is called vncviewer, the server command is vncserver. Other clients are also available, such as the Remote Desktop Connection application of KDE.

Invoking VNC

From Linux

vncviewer <ip>

This will prompt for the password of the VNC server, before displaying a window with the desktop of the remote machine.

Users of KDE can also install the kdenetwork-krfb package to get krdc, which is has an easy to use GUI interface:

krdc

From Windows

To install it on Windows Google for 'vncviewer'. There are several different VNC projects but their viewers should be compatible with each other.

From a Web Browser

It is possible to connect to a VNC viewer using a java enabled browser. This is makes VNC technology much more flexible, as no special software is required on the client. This is done by entering the IP address of VNC server followed by the port 5800 +display number though ports are customizable. e.g.

http://192.168.1.1:5801 - Typical for a windows box
http://192.168.1.1:5802 - Typical for a linux box (displays second X display)

Starting the vnc server

Starting the vnc server is quite easy:

vncserver

For a Web Browser

vncserver -httpport 80

Starts the vnc server that can be accessed over the default http port 80.

Tunnelling Over SSH

Like most other protocols VNC can be 'tunnelled' over ssh. There are two significant advantages to this:

  1. Its encrypted and as secure as your ssh connection
  2. It can go anywhere ssh goes, ie. if you can ssh to the machine you can also VNC to it no matter whether any firewalls/routing in between actually allows you to access VNC. The flipside advantage of this is for the owner/administrator of the machine running VNC as they don't have to leave it open to the Internet (its not hugely secure) to allow people to use it for remote access.

Sounds good? Here's how to do it:

From Windows

See: http://martybugs.net/smoothwall/puttyvnc.cgi

From Linux

ssh username@remotemachine -L 5901:localhost:5901

Now connect to it with vncviewer (see "Invoking VNC" section above) using localhost:1 or localhost:0.

Configuration

Your vnc server's configuration is stored in ~/.vnc. Most important file is xstartup. For example, the following content of xstartup will make your vnc server start KDE at logon:

#!/bin/sh
xsetroot -solid grey
startkde

Products

Alternatives

Operating systems using the X Window System can use the X Display Manager Control Protocol (XDMCP) to allow network based access to a remote system's graphical desktop. XDMCP uses much less network bandwith than VNC, but it requires an X server. There are X servers available for non-UNIX OS's.

Faster than VNC and with sound.

See also