Configure vncserver on Ubuntu

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 21:17, 5 March 2015 by Admin (Talk | contribs)

Jump to: navigation, search

A VNC server is a program that shares a desktop with other computers over a network. Vino is the default VNC server in Ubuntu Linux. x11vnc is another VNC server that uses tcl/tk based GUI and is not dependent on any one particular graphical environment. Krfb is the default VNC server in Kubuntu that is integrated with KDE. The useful tightvnc creates a completely new desktop, not attached to any actual screen. You won't see what is going on in the vnc session from the host machine. Because of this you may need to consider which you prefer and what you are trying to accomplish.

Ubuntu version 12.04 through the latest tested (14.04) the default VNC Server only lets you connect remotely once the user has logged into Gnome or XFCE. This is not useful for a remote headless system. To configure the VNC Server to start with the system and listen before a user is logged in locally the vncserver must be configured to start with the system services. For this it is the most simple to install x11vnc.

x11vnc to start with X.org

Obviously you need x11vnc installed before proceeding. Once installed...

First set a master password.

sudo x11vnc -storepasswd /etc/x11vnc.pass

Now an init script needs to be created so the vncserver starts at boot.

sudo vi /etc/init/x11vnc.conf

Creating an init script called xllvnc.conf in the /etc/init directory. Now add the following code to the script:

start on login-session-start
script /usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log
end script

If you're using Ubuntu the xllvnc binary should be in the path /usr/bin/xllvnc. You can test to make sure it is installed and present in that path location by typing

file /usr/bin/xllvnc

When you reboot the system the VNC Server should be running. You can connect remotely prior to a local user starting a desktop session, or afterwards. You can start a desktop session remotely via vncviewer. It will be a shared session. You will see the same thing and will be controlling the same desktop that the local user is using. There is a way to have it create a separate session, however, that is not covered here.

REFERENCES AND SOURCES;

TightVNC server

tightvnc is designed to be run from the command-line. To start it, type:

tightvncserver -nolisten tcp :1

To only allow local connections and automatically disconnect clients, start tightvnc by typing:

tightvncserver -nolisten tcp -localhost -nevershared :1

Then when your client is disconnected by the next client connecting, type:

tightvncserver -kill :1