Warning message

The service having id "facebook_widget" is missing, reactivate its module or save again the list of services.

Raspberry Pi configure screen sharing with VNC

I've spent the past week exploring what my Raspberry Pi can do. It makes a great little server as it's tiny and consumes negligible power, about 3.5 watts. Of course as with any Linux box, there is little need for a monitor, so I've configured VNC to work seamlessly on my Raspberry Pi.

Here's how:


1. Configure your Raspberry Pi with a static IP address.

2. Open LXTerminal and type

sudo apt-get install tightvncserver

Complete the setup as prompted
pi@raspberrypi:~$ vncserver

You will require a password to access your desktops.

Warning: password truncated to the length of 8.
Would you like to enter a view-only password (y/n)? n

New 'X' desktop is raspberrypi:1

Creating default startup script /home/pi/.vnc/xstartup
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspberrypi:1.log

3. Create a script to ensure that VNC starts at boot time.

Type: cd /etc/init.d
sudo pico tightvncserver
and add this to the file (you can copy and paste)
# Provides: tightvncserver
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: vnc server
# Description:
#! /bin/sh
# /etc/init.d/tightvncserver

# Carry out specific functions when asked to by the system
case "$1" in
su pi -c '/usr/bin/vncserver'
echo "Starting VNC server "
pkill vncserver
echo "VNC Server has been stopped (didn't double check though)"
echo "Usage: /etc/init.d/blah {start|stop}"
exit 1

exit 0

4. Make the script executable
sudo chmod +x tightvncserver

5. Created the correct symbolic links for reboot and shutdown:
sudo update-rc.d tightvncserver defaults

6. Let's test the script. Kill the VNC service with this command:
sudo pkill Xtightvnc

7. And run the new script to start the VNC service:
sudo /etc/init.d/tightvncserver start

and you should see

New 'X' desktop is raspberrypi:1
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspberrypi:1.log


In the "stop" part of the script I had to use
pkill Xtightvnc
instead of
pkill vncserver.
Apart from that, everything worked great.

Brilliant tutorial
Thanks very much

Hmm, it all seemed to setup ok, but I'm getting connection refused from the client end.
port 5901 is open.. and my vnc log says:

22/10/12 16:03:29 Xvnc version TightVNC-1.3.9

22/10/12 16:03:29 Copyright (C) 2000-2007 TightVNC Group

22/10/12 16:03:29 Copyright (C) 1999 AT&T Laboratories Cambridge

22/10/12 16:03:29 All Rights Reserved.

22/10/12 16:03:29 See http://www.tightvnc.com/ for information on TightVNC

22/10/12 16:03:29 Desktop name 'X' (raspberrypi:1)

22/10/12 16:03:29 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t

22/10/12 16:03:29 Listening for VNC connections on TCP port 5901

Font directory '/usr/share/fonts/X11/Type1/' not found - ignoring

Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring

Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring

xrdb: No such file or directory

xrdb: can't open file '/home/pi/.Xresources'


22/10/12 16:05:52 Got connection from client

22/10/12 16:05:52 rfbProcessClientProtocolVersion: client gone

22/10/12 16:05:52 Client gone

22/10/12 16:05:52 Statistics:

22/10/12 16:05:52   framebuffer updates 0, rectangles 0, bytes 0


Any ideas?


Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Enter the characters shown in the image.
Refresh Type the characters you see in this picture. Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.