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!
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:
- Pi has an OS with Desktop and is connected to the internet.
- Dataplicity is installed.
- We are logged in as Pi user.
- Port 80 is free.
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
When the above installer has finished setting up VNC we use the command below to start a VNC session.
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.
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:
Using our wormhole link that will look similar to:
ABCD-EFGH-1234 part will be unique to our account. We simply add VNC related part to it as shown below.
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.
Having entered the password we click on 'Connect' ...
...and there's our Pi's desktop.
To uninstall VNC from your Raspberry Pi, follow these steps:
- Stop the remote_desktop service:
sudo systemctl stop remote_desktop
- Disable the remote_desktop service:
sudo systemctl disable remote_desktop
- Remove the remote_desktop service file:
sudo rm /etc/systemd/system/remote_desktop.service
-- Dataplicty Team 🤗
Updated 4 months ago