Remotely access Pi desktop

With Dataplicity Wormhole and VNC we can extend beyond our web terminal and access our Pi's desktop from our browser, even from behind a firewall!

1112

Overview

VNC (Virtual Network Computing) is a well established method of sharing the desktop from one device to another on the same network.

On the target device, a VNC server (in this guide we'll use 'tightvnc') is installed, and we'll use a VNC client (in this case 'noVNC') to access the device.

The VNC server will typically listen on port 5901 and will speak a protocol incompatible with standard web traffic (HTTPS). In this example we use 'websockify' to translate this traffic into websockets for transport over Dataplicity Wormhole, and we use noVNC to make the whole system accessible from our web browser.

👍

Please ensure the following before proceeding:


Install VNC

In a terminal window on our Pi, ensuring we are at the pi@raspberrypi prompt, we copy/paste the command below. It is an automated installer that will prepare everything for us.

curl -s https://raw.githubusercontent.com/wildfoundry/specialprojects-public/remote-desktop/install.bash | sudo bash

Start VNC

When the above installer has finished setting up VNC we use the command below to start a VNC session.

sudo /opt/remote_desktop/start

On the first launch of the above command VNC will ask us to set up an access password that will be used every time we access the desktop of our Pi.


Access the desktop remotely

Having completed the steps above we're now ready to use Wormhole for remote desktop access. Normally, to access our wormhole we will find its link in our device's options pane:

567

Using our wormhole link that will look similar to:

https://ABCD-EFGH-1234-device.dataplicity.io/

Where the ABCD-EFGH-1234 part will be unique to our account. We simply add VNC related part to it as shown below.

https://ABCD-EFGH-1234-device.dataplicity.io/vnc.html

Entering this link in our browser will present us with a dialogue box that asks for a password. This is the VNC password we configured earlier in this guide. The 'Token' box may be left blank.

1136

Having entered the password we click on 'Connect' ...
...and there's our Pi's desktop.

1112

Uninstall

To uninstall VNC from your Raspberry Pi, follow these steps:

  1. Stop the remote_desktop service:
sudo systemctl stop remote_desktop
  1. Disable the remote_desktop service:
sudo systemctl disable remote_desktop
  1. Remove the remote_desktop service file:
sudo rm /etc/systemd/system/remote_desktop.service

Enjoy!
-- Dataplicty Team 🤗