How to VNC into an existing X session

Recently I installed LXDE on my raspberry PI. This is very light desktop environment but it does not provide extra packages for cutomization. I needed to enable VNC and I found it very difficult, since all VNC servers create another Virtual Window on active login session and I needed to have VNC session on my current login session.

Here I will guide you to create a VNC session connecting the current login session.

I used a very light and fast package in Ubuntu repository.

Install it by typing:

root@raspberrypi:/home/pi# apt-get install x11vnc

Now after installation we need to enable VNC server for current login session:

root@raspberrypi:/home/pi# x11vnc -display :0

The above command will let the client connect to existing login session.

On the client side we need to install any VNC Viewer like realvnc or tightvnc and just enter server IP and authentication details to access.

To enable x11vnc on boot we need to add it in x sessions by adding below:

vim /home/pi/.config/lxsession/LXDE/autostart

@lxpanel –profile LXDE
@pcmanfm –desktop –profile LXDE
@xscreensaver -no-splash
@firefox-esr –display :0
@x11vnc –display :0

The above will ensure starting VNC server after every reboot for user pi.



Source :

Leave a Reply

Your email address will not be published.