Difference between revisions of "RPi VNC Screen Sharing"

From eLinux.org
Jump to: navigation, search
(added alternative to vino-preferences, autostart method. tested on raspbian jessie)
(dbus-launcher)
 
(6 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
  
'''Raspberry Pi VNC Screen Sharing'''
+
'''Raspberry Pi VNC Screen Sharing / Remote control'''
  
 
=What does it do?=
 
=What does it do?=
  
Sometimes it is convenient to share screens 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 then the one the console is using.
+
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?=
 
=What do you need?=
Line 28: Line 28:
 
=How does it work?=
 
=How does it work?=
  
The commands described below start a "virtual" graphical session. It allows a user to controll mouse, keyboard and screen on a remote Raspberry Pi to for example do support.  
+
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=
 
=Overview of this project=
Line 38: Line 38:
  
 
=Instructions=
 
=Instructions=
 +
==Installation==
 
Log in to your Pi and install the Vino Package
 
Log in to your Pi and install the Vino Package
 
  $ sudo apt-get install vino
 
  $ sudo apt-get install vino
 
Next Run X11 (if in CLI mode)
 
Next Run X11 (if in CLI mode)
 
  $ startx
 
  $ startx
 +
 +
==Configuration==
 
Once that is done you can run the vino-preferences from the terminal.
 
Once that is done you can run the vino-preferences from the terminal.
 
  $ vino-preferences
 
  $ vino-preferences
Line 52: Line 55:
 
  sudo apt-get install vino
 
  sudo apt-get install vino
  
If the installed version of vino lacks the mocule vino-preferences, configure with gsettings:
+
If the installed version of vino lacks the module vino-preferences, use gsettings from terminal:
 
* to avoid problems with encryption and some vnc viewers:
 
* to avoid problems with encryption and some vnc viewers:
 
  gsettings set org.gnome.Vino require-encryption false
 
  gsettings set org.gnome.Vino require-encryption false
Line 62: Line 65:
 
  gsettings set org.gnome.Vino authentication-methods "['vnc']"
 
  gsettings set org.gnome.Vino authentication-methods "['vnc']"
 
  gsettings set org.gnome.Vino vnc-password "$(echo -n "insertnewpass" | base64)"
 
  gsettings set org.gnome.Vino vnc-password "$(echo -n "insertnewpass" | base64)"
 +
 +
If you're working over SSH, use dbus-launcher to invoke gsettings
  
 
You can also chage this values with dconf-editor
 
You can also chage this values with dconf-editor
Line 68: Line 73:
 
  echo -n "insertnewpass" | base64
 
  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:
 
Now Raspbian doesn't autostart vino, so we have to fix that, there're two methods:
  
'''1) LXDE autostart'''
+
====LXDE autostart====
  
 
Make a script in the /etc/sudoers.d folder.
 
Make a script in the /etc/sudoers.d folder.
Line 94: Line 99:
 
  @/etc/sudoers.d/vsrv.sh
 
  @/etc/sudoers.d/vsrv.sh
  
'''2) lightdm autostart (tested on Raspbian Jessie)'''
+
 
 +
====lightdm autostart (tested on Raspbian Jessie)====
  
 
Make a config file in /etc/xdg/autostart/
 
Make a config file in /etc/xdg/autostart/
Line 114: Line 120:
 
To apply changes, reboot the Raspberry Pi
 
To apply changes, reboot the Raspberry Pi
  
==Access remotely==
+
=Access remotely=
  
 
Install UltraVNC (if you run windows) or Tight VNC on your desktop from the link below.
 
Install UltraVNC (if you run windows) or Tight VNC on your desktop from the link below.

Latest revision as of 10:00, 12 April 2017

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

Instructions

Installation

Log in to your Pi and install the Vino Package

$ sudo apt-get install vino

Next Run X11 (if in CLI mode)

$ startx

Configuration

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, use 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)"

If you're working over SSH, use dbus-launcher to invoke gsettings

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
/usr/lib/vino/vino-server

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

@/etc/sudoers.d/vsrv.sh


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
Exec=/usr/lib/vino/vino-server
Terminal=false
Type=Application
X-GNOME-Autostart-Phase=Applications
X-GNOME-AutoRestart=true
NoDisplay=true


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.

http://www.uvnc.com
http://www.tightvnc.com/download.php

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

$ sudo apt-get install xtightvncviewer

or

$ 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. 192.168.1.2:1) 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.