RPi VNC Screen Sharing

From eLinux.org
Jump to: navigation, search

Back to RPi Guides.

Raspberry Pi VNC Screen Sharing / Remote control

What does it do?

Sometimes it is convenient to share screens (remote control) to be able to do support from your own computer. This works just like the VNC Server, with the difference you don't log in to another user than the one the console is using.

What do you need?

  • A Raspberry Pi, model B.
  • A boot SD card for the Raspberry Pi.
  • A network connection (Ethernet or WiFi).
  • Special software on both the Raspberry Pi and the remote, controlling computer

What skill level is required?

This project does not require any coding or compilation. Very basic Linux and networking knowledge would be useful, but not essential.

You need to...

  • Install software
  • Enter basic Linux commands
  • Use standard software tools (Windows/Linux/Mac) to add software to your PC
  • Connect computers using ethernet cables

How does it work?

The commands described below start a "virtual" graphical session. It allows a user to control mouse, keyboard and screen on a remote Raspberry Pi to for example do support.

Overview of this project

You need to

  • Install Vino VNC (Virtual Network Computing) server software on the Raspberry Pi
  • Start and configure the VNC server software
  • Install a VNC client on another computer
  • Connect over a network from your computer to the Raspberry Pi



Log in to your Pi and install the Vino Package

$ sudo apt-get install vino

Next Run X11 (if in CLI mode)

$ startx


Once that is done you can run the vino-preferences from the terminal.

$ vino-preferences

Configure it like you want it to work, if you want to be able to controll the remote Raspberry Pi computer without remote confirmation you have to check booth "Allow" boxes on top, uncheck the third "confirm" box and as a good recommendation check the 4 box about "Require user password" and enter a password you'll remember. The rest isn't that important so just click "Close" after that.

When closing vino-prefereces you may get an error message something like:

Gtk-CRITICAL **: gtk_entry_set_text: assertion `text != NULL' failed

One possible work around for this bug is to re-install vino.

sudo apt-get remove vino
sudo apt-get install vino

If the installed version of vino lacks the module vino-preferences, configure with gsettings from terminal:

  • to avoid problems with encryption and some vnc viewers:
gsettings set org.gnome.Vino require-encryption false
  • if you are having problems connecting, try disabling user confirmation
gsettings set org.gnome.Vino prompt-enabled false
  • to disable login password
 gsettings set org.gnome.Vino authentication-methods "['none']"
  • to enable login password
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password "$(echo -n "insertnewpass" | base64)"

You can also chage this values with dconf-editor

apt-get install dconf-editor

and search in the tree org.gnome.desktop.remote-access, but keep in mind the password must be encoded in base64, you can do it with:

echo -n "insertnewpass" | base64

Starting vino at system boot

Now Raspbian doesn't autostart vino, so we have to fix that, there're two methods:

LXDE autostart

Make a script in the /etc/sudoers.d folder.

$ sudo leafpad /etc/sudoers.d/vsrv.sh &

and put the following in that file.

#! /bin/bash

Set the file to Execute

$ sudo chmod +x vsrv.sh

Then this file has to autorun when we start X11, on Raspbian this can be done by editing the /etc/xdg/lxsession/LXDE/autostart file:

$ sudo leafpad /etc/xdg/lxsession/LXDE/autostart &

Just add one line at the end of the file


lightdm autostart (tested on Raspbian Jessie)

Make a config file in /etc/xdg/autostart/

sudo nano /etc/xdg/autostart/vino-server.desktop

and fill in with this text:

[Desktop Entry]
Name=Desktop Sharing
Comment=GNOME Desktop Sharing Server

To apply changes, reboot the Raspberry Pi

Access remotely

Install UltraVNC (if you run windows) or Tight VNC on your desktop from the link below.


Or install it using your package manager. The following works on my ubuntu 11.10 workstation

$ sudo apt-get install xtightvncviewer


$ sudo apt-get install remmina

Remmina is a remote client that can handle multiple protocolls, really handy.

Then use <Your Pi IP>:1 (e.g. as the host name when connecting.[1]

  1. You can put your raspberry pi in /etc/hosts on Linux systems. I think you can make such a file on windows too. Then you can refer to your raspberry pi as "rpi" or whatever you called it.