In this article
Virtual Network Computing (VNC) is a graphical desktop-sharing system built on the Remote Frame Buffer (RFB) protocol. It lets you see and control another computer’s desktop over a network, which is handy for IoT boards like Raspberry Pi, Nvidia Jetson Nano and Google Coral that sit somewhere you can’t plug in a monitor.
The hard part is usually reaching the device at all, since most boards live behind a home router, a cellular modem or CGNAT with no public port. This guide sets up a VNC server on the device, exposes it with a Pinggy TCP tunnel over SSH, and connects to it from a VNC viewer on your laptop. Nothing gets opened on the router.
Summary
- Step 1. Start a VNC server on your IoT device. On Raspberry Pi OS with the desktop,
sudo raspi-config nonint do_vnc 0turns on WayVNC (port5900). On Ubuntu, Debian or Pi OS Lite, install XFCE and TigerVNC (port5901):
sudo apt update
sudo apt install -y xfce4 xfce4-goodies dbus-x11 tigervnc-standalone-server tigervnc-tools
vncpasswd
vncserver :1 -geometry 1600x900 -- xfce- Step 2. Create a TCP tunnel with Pinggy to the VNC port (
5900for WayVNC):
ssh -p 443 -R0:localhost:5901 tcp@free.pinggy.ioYou will recieve an address like tcp://abcde-203-0-113-7.run.pinggy-free.link:43527.
- Step 3. Install a VNC viewer on your PC:
TigerVNC: Download here
RealVNC: Download here
Enter the host and port without tcp://, for example abcde-203-0-113-7.run.pinggy-free.link:43527, then your VNC password (or your Pi login for WayVNC).
Step-by-Step Guide
Running Raspberry Pi OS with the desktop? Current Raspberry Pi OS, based on Debian 13 “trixie”, runs the labwc Wayland compositor and ships WayVNC, which shares the desktop already on screen. Turn it on in Preferences > Control Centre > Interfaces > VNC, in sudo raspi-config under 3 Interface Options > I3 VNC, or over SSH:
sudo raspi-config nonint do_vnc 0WayVNC listens on port 5900, takes your Pi username and password, and encrypts the session, so skip to Step 3 and tunnel port 5900. If the Pi boots to the console, labwc isn’t running and raspi-config enables RealVNC Server instead (see the Raspberry Pi docs).
Steps 1 and 2 are for boards with no desktop to share: Raspberry Pi OS Lite, Ubuntu Server and most Debian-based IoT images.
(Optional) Step 1: Install Desktop Environment
If your device has no graphical desktop, install XFCE, which is light enough for small boards. xfce4-goodies is optional, and dbus-x11 lets the session start inside a VNC server:
sudo apt update && sudo apt upgrade -y
sudo apt install -y xfce4 xfce4-goodies dbus-x11Step 2: Install and Configure a VNC Server
There are several VNC servers for Linux, such as TigerVNC, TightVNC and RealVNC Server. We’ll use TigerVNC: it’s maintained (Debian trixie packages 1.15.0) and supports TLS. Older guides, and the screenshots below, use tightvncserver. It still installs and works, but it’s the old TightVNC 1.3.10 release with classic VNC authentication and no encryption.
- Install the VNC Server:
sudo apt install -y tigervnc-standalone-server tigervnc-toolsOn the older TightVNC route, the command is sudo apt install -y tightvncserver, which is what this screenshot shows:

- Set VNC Password:
Run this as the user who will own the desktop, not with sudo:
vncpasswdWith tightvncserver, the first vncserver run asks for the password instead.

You’ll be prompted for:
- A mandatory access password, 6 to 8 characters (longer ones are cut or refused)
- An optional view-only password (you can skip it)
On the TightVNC route, stop the instance that first run started:
vncserver -kill :1- Configure VNC Startup File:
TigerVNC doesn’t need one, because you name the session when you start it in the next step. For tightvncserver, back up the original startup file and replace it with one that runs XFCE:
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
printf '#!/bin/bash\nxrdb $HOME/.Xresources\nstartxfce4 &\n' > ~/.vnc/xstartup
chmod +x ~/.vnc/xstartup- Start the VNC Server:
vncserver :1 -geometry 1600x900 -- xfceOn Debian and Ubuntu, TigerVNC’s vncserver wrapper listens only on localhost:5901 by default, which is exactly what teh tunnel needs. On the TightVNC route, run vncserver -localhost :1; without -localhost it listens on port 5901 on every interface.
Step 3: Secure Remote Access Using Pinggy
On the device, start a Pinggy TCP tunnel to the VNC port. It only needs the OpenSSH client:
ssh -p 443 -R0:localhost:5901 tcp@free.pinggy.ioUse 5900 instead of 5901 for WayVNC on Raspberry Pi OS.
Customize your command:
Pinggy answers with a public address:
You are not authenticated.
Your tunnel will expire in 60 minutes. Upgrade to Pinggy Pro to get unrestricted tunnels. https://dashboard.pinggy.io
tcp://abcde-203-0-113-7.run.pinggy-free.link:43527
Your hostname may look different from the screenshot’s; copy whatever yours prints. A free tunnel lasts 60 minutes and gets a new address on every reconnect. A Pinggy Pro token removes the time limit, but TCP ports still change per connection unless you reserve one in the dashboard. If the tunnel drops on a flaky connection, add -o ServerAliveInterval=60 to the command.
Step 4: Installing VNC Viewer on Your Laptop/PC
Install a VNC viewer on your local machine:
- TigerVNC Viewer: Download TigerVNC. The Raspberry Pi docs recommend it, and it handles WayVNC’s encryption and the TLS setup below.
- RealVNC Viewer: Download RealVNC Viewer
Open the viewer and enter the host and port from Pinggy, without tcp://:
- Example:
abcde-203-0-113-7.run.pinggy-free.link:43527
TigerVNC only reads host:N as a display number when N is below 100, so a five-digit Pinggy port goes straight through; host::43527 with two colons always means a port. Click Connect and enter your VNC password, or your Pi username and password for WayVNC. WayVNC’s certificate is self-signed, so TigerVNC warns about it on first connect, and the Raspberry Pi docs say to accept.

Best Practices and Security Tips
The leg from the device to Pinggy is SSH, so it’s always encrypted. The leg from your viewer to Pinggy carries VNC exactly as the server speaks it, so it’s only encrypted if the VNC server is.
- Strong Passwords: WayVNC uses your Pi login, so give that account a strong password. Classic VNC passwords stop at 8 characters, so use 8 random ones, not a word.
- Encrypt the VNC Session: WayVNC encrypts out of the box. TigerVNC on Debian and Ubuntu defaults to
VncAuth, which keeps the password off the wire but sends your screen and keystrokes unencrypted. Start it with TLS instead, and keep-localhost yes, because once you list a TLS type the wrapper otherwise listens on every interface:
vncserver -kill :1
vncserver :1 -localhost yes -SecurityTypes TLSVnc -geometry 1600x900 -- xfceTLSVnc is anonymous TLS: it encrypts the session but doesn’t verify the server’s identity. Connect with the TigerVNC viewer, since viewers without VeNCrypt support won’t connect. tightvncserver can’t encrypt at all.
- Firewall Management: The tunnel needs no inbound port, so keep the router closed and the VNC server on
localhost. To limit who can reach the public port, add Pinggy’s IP whitelist with your public IP; a comma-separated list allows several:
ssh -p 443 -R0:localhost:5901 -t tcp@free.pinggy.io w:203.0.113.5- Close It When Done: Ctrl+C on the
sshcommand closes the public port right away.
Conclusion
You now have a VNC server on your IoT device (WayVNC on Raspberry Pi OS, or TigerVNC with XFCE elsewhere), a Pinggy TCP tunnel carrying it out from behind NAT, and a viewer on your laptop to open the desktop. Before you leave it running, make sure the VNC session itself is encrypted and put your IP on the tunnel’s whitelist.