Skip to content

Remote desktop control of a Raspberry Pi

2016 June 8
by Tedb0t

Say you want to configure a nifty dashboard powered by a Raspberry Pi. You can attach a keyboard and mouse to it, but that’s for suckers—we want to control it over the network.  Should be simple, right? We’ll just use X11 or VNC!

Wrong.  It turns out that BOTH X11-forwarding and the Raspbian-included tightvnc start new displays instead of controlling the existing one, and as far as I can tell, cannot be used for that purpose. Super lame.  However, there does turn out to be an easy solution: x11vnc.

  1. First you’ll need to get into your Pi, either locally (kb & mouse) or via SSH.
  2. Once you’re in, install x11vnc:
    sudo apt-get install x11vnc
  3. Setup x11vnc for the first time:
    x11vnc -storepasswd

    It will prompt for a password to use for future connection attempts.

  4. To make x11vnc start at login (since we’re assuming this is a dashboard starting up with an x-window session):
    mkdir /home/pi/.config/autostart
    touch /home/pi/.config/autostart/x11vnc.desktop
    nano /home/pi/.config/autostart/x11vnc.desktop
  5. Paste this in:
    [Desktop Entry]
    Name=X11VNC Server
    Comment=Share this desktop by VNC
    Exec=x11vnc -forever -usepw -httpport 5900 -auth guess
    Icon=computer
    Terminal=false
    Type=Application
    StartupNotify=false
    #StartupWMClass=x11vnc_port_prompt
    Categories=Network;RemoteAccess;
  6. Hit Ctrl-O to save and Ctrl-X to exit
  7. Then reboot:
    sudo reboot
  8. Once the Pi’s back up and you’re logged back in, make sure x11vnc is running:
    ps -ef | grep vnc

    In the results you should see:

    ... x11vnc -forever -usepw -httpport 5900 -auth guess
  9. Great! Now you can connect to and control your Pi from the VNC client of your choice. Remember that OSX actually has one already, called “Screen Sharing.” Just hit command-space to search and start typing that name and it’ll pop right up.  Then put this in as the host:
    <ip of Pi>:5900

Enjoy! Let me know if this works for you.

Related Posts:


No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS