You remotely access your Raspberry Pi desktop from anywhere using Remote Desktop Protocol (RDP). Even if your Pi is outside your local network, you can access it easily over the internet using Pinggy.
The Remote Desktop Protocol (RDP) enables users to connect to and control Raspberry Pi or similar devices via a network connection. However, this is only possible if the device is on the local network (LAN) or has a public IP address. Often, Raspberry Pi and similar devices are located behind NAT or CGNAT, as well as firewalls, lacking a public IP address. In such situations, Pinggy.io can be employed to access your device over the internet, providing a public address without requiring software installation. Through the Pinggy TCP tunnel, you can access your RDP-enabled device over the internet, circumventing NAT and firewalls.
The above video shows you the steps. Below is an outline of how to remotely access your Raspberry Pi like device from anywhere over the internet.
On your device install an RDP server such as xrdp. On your Raspberry Pi, you can install xrdp using the following commands in the terminal:
sudo apt update sudo apt install xrdp sudo systemctl start xrdp
To get a public URL to access your Raspberry Pi over the internet bypassing NAT and firewall, you need to start a Pinggy tunnel. Just copy and paste the following command to start a tunnel.
After running the tunneling command, you will receive a public URL in the following format: tcp://tljocjkijs.a.pinggy.online:40527
Make note of this URL (tljocjkijs.a.pinggy.online) and port (40527) as they will be used to establish an RDP connection to your Raspberry Pi or other IoT device.
To avoid copying the URL, you can sign in to https://dashboard.pinggy.io to get an access token. When you start a tunnel using your access token, you can find ongoing tunnel URLs from the dashboard.
Open Remote Desktop Connection application on your Windows / Microsoft Remote Desktop on Mac. Enter the URL:Port to connect.
Pinggy free tunnels expire after 60 minutes, and the URLs change after reconnection. To avoid this, sign in to https://dashboard.pinggy.io and get an access token. Then run the tunnel in auto-reconnection mode.
while true; do ssh -p 443 -o ServerAliveInterval=30 -R0:localhost:3389 email@example.com; sleep 10; done
From the Pinggy dashboard you will be able to see the list of your active tunnels.