Ubuntu 14.10 – Configure your sytem to have x11vnc running at startup

Ubuntu 14.10 – Configure your sytem to have x11vnc running at startup
November 2, 2014 Griffon
X11VNC

Important Note :

If you need to perform the same configuration on Ubuntu 15.04, you would follow the following instructions Ubuntu 15.04 – Configure your system to have x11vnc running at startup. The post hereafter applies to Ubuntu systems where the Upstart component is used. Since Ubuntu 15.04, Upstart has been replaced by systemd component

Hello World,

Today we will speak about Remote connection to an Ubuntu machine (or more generically a Linux Machine). Normally, we tend to use the xrdp solution to connect to a remote Ubuntu machine. Now, we had a request to have remote access configured on a Ubuntu Machine but using vnc technology.

As long as the machine is up and running and that a user is logged into the machine, vnc technology can be used to share and access the desktop remotely. We have been tasked to configure the Ubuntu machine in a way to ensure that the vnc server would start at boot time.

We didn’t invent anything here. We have used the information found on the web (see references and sources sections).

Reference and Sources

http://www.tavshed.com/?p=118
http://seb.so/vnc-from-boot-without-logging-in-ubuntu-lubuntu-xubuntu-and-mint-lmde/

In this post, we will describe how we did it and see if this is working between multiple reboot. At the end of this post, you should be able to connect via vnc to your Ubuntu machine even if there is a reboot and even if no user are logged into the machine. This configuration should display the login screen via vnc viewer client you are using

Let’s Go !

Installing x11vnc server
If you follow us, you know that we tend to use x11vnc software to provide vnc capabilities. For this post and this configuration, we will be installing the x11vnc server.

The installation process is quite straight forward. Log into your ubuntu 14.10 machine, open the terminal console and issue the following command :

sudo apt-get install x11vnc

VncUb14.10_1

Click on Picture for Better Resolution

To have a minimum of security, we will protect the vnc connection via a password. The password will be stored in a file. To create this file, you will need to issue the following command

sudo x11vnc –storepasswd /etc/x11vnc.pass
You will be asked to enter a password. Enter the password and confirm your choice and you should be good to go

VncUb14.10_2

Click on Picture for Better Resolution

Create the Startup Script
So far, we have just issued standard command related to the x11vnc package. We need to make the x11vnc service starting at boot time. To to this, we will create the following script (info found at http://seb.so/vnc-from-boot-without-logging-in-ubuntu-lubuntu-xubuntu-and-mint-lmde/)

/etc/init/x11vnc.conf :

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
Once this is done, you can simply reboot your machine. You should be able to connect to your Ubuntu machine using vnc viewer client.

Note :

in the script, The line starting with /usr/bin/… should one line. For presentation reasons, the line has been break into multiple lines.

Test your configuration
To check that you can indeed perform a vnc connection to your Ubuntu Machine, you will try to connect to it using your favourite vncviewer (we are using TigerVnc) while nobody is connected and just after a reboot of the machine.

In the vncviewer, you will provide the ip address or hostname of the machine to connect and the port to be used. In our example, he port used is 5900. If you have set a password to protect your vnc connection, you will be prompted for a password as well.

VncUb14.10_6

Click on Picture for Better Resolution

If everything is ok, you should see the Ubutun login page displayed inside your vncviewer

VncUb14.10_4

Click on Picture for Better Resolution

After login into your machine via vncviewer, you should be able to connect to your Unity Desktop and start working on it. Here because we are connecting directly to the console, we do not need to install any alternative desktop as this would be the case with xrdp software

VncUb14.10_5

Click on Picture for Better Resolution

And Voila ! Now you should be able to login to your Ubuntu machine remotely using the VNC protocol and using your preferred vnc viewer client. This is cool but you might have some drawback or limitation using this method.

The drawback of this method is that whatever you type on your vnc viewer session could be viewed by a user located in front of the computer you are remotely connected to. Actually, this should be a minor problem given that a lot of machine are virtualized and you do not have a screen in front of each machine nowadays.

The other problem using this method to remotely connect to your Ubuntu machine is the fact that you have to install a vncviewer on all your machines where such remote access is needed. However, if you are creative you could quickly overcome this limitation (using a web based vnc browser or publish the application on your Remote Desktop Session server as a remoteapp application)

Finally, security wise it seems that vnc should not be used on internet and should be recommended on your intranet infrastructure. This limitation might be overcome by using encrypted sessions.

Final Notes
In this post, we have seen how we could configure vnc server (i.e. x11vnc) to boot at startup and allow users to connect to the remote machine even if nobody is logged into the machine. The main drawback we see with this method is that you have to install everywhere the vnc viewer client. At least this would be the standard approach within most organization. However, there are plenty of other options. We could install the client as a remoteApp published application and you would not need to have the software installed locally. You could also use a web based vnc viewer.

In the coming posts, we might investigate the web based vnc viewer solution

Stay tuned

Till next time

by: http://c-nergy.be/blog/?p=5870