Home > IoT > How to Access Raspberry Pi Remote Desktop Over the Internet using xRDP

How to Access Raspberry Pi Remote Desktop Over the Internet using xRDP

Author: Ganesh Velrajan

Last Updated: Jul 14, 2026

When it comes to accessing a Raspberry Pi’s graphical desktop from a Windows machine, xRDP is the most seamless choice — Windows Remote Desktop Connection is built-in on every Windows 10 and 11 machine, while VNC requires a separate viewer download. The challenge, as with all Raspberry Pi remote access scenarios, is that the Pi sits behind a NAT router or CGNAT with no public-facing RDP port, making direct connection from the internet impossible without port forwarding.

TL;DR — Raspberry Pi xRDP remote desktop in 4 steps:

  1. Install xRDP on the Pi: sudo apt install xrdp && sudo systemctl enable --now xrdp (port 3389)
  2. Install SocketXP on the Pi and run socketxp connect tcp://localhost:3389
  3. Run SocketXP in slave mode on your Windows PC or Mac to create a local proxy on localhost:3000
  4. Open Remote Desktop Connection (Windows) or Microsoft Remote Desktop (Mac), connect to localhost:3000

No port forwarding, no static IP, no VPN — the SocketXP tunnel handles NAT and CGNAT transparently.

Raspberry Pi Remote Desktop Access via xRDP over the Internet using SocketXP

What is xRDP and Why Use It on Raspberry Pi?

RDP (Remote Desktop Protocol) is a network protocol developed by Microsoft for graphical remote desktop sessions. It is built into Windows as Remote Desktop Connection (RDC) and is available natively on macOS via Microsoft Remote Desktop.

xRDP is the open-source Linux implementation of RDP. It runs on your Raspberry Pi as a server, accepting incoming RDP connections and rendering the Pi’s desktop to the connecting client. This means:

  • Windows users can connect using the built-in Remote Desktop Connection — no third-party software
  • Mac users can use the free Microsoft Remote Desktop app from the Mac App Store
  • Linux users can use Remmina or any other RDP client

Compared to VNC, xRDP typically provides a more responsive and integrated experience on Windows, since RDP was designed for that ecosystem.

The Core Challenge: Port 3389 Is Not Reachable from the Internet

xRDP listens on TCP port 3389 on the Raspberry Pi’s local IP address. From outside the Pi’s network:

  • The Pi’s private IP (192.168.x.x) is not internet-routable
  • Port 3389 is not forwarded through the router (and may be impossible with CGNAT)
  • Opening port 3389 to the internet is a significant security risk — RDP is one of the most frequently brute-forced protocols on the internet
  • Corporate and campus firewalls routinely block inbound port 3389

SocketXP resolves this by reversing the connection. The Pi’s SocketXP agent dials outbound SSL/TLS reverse proxy tunnel to the SocketXP cloud gateway over port 9443 (or optionally, port 80). Your access device then connects inward through that existing tunnel — no port 3389 is ever exposed to the internet.

Step 1: Set Up a Desktop Environment on Raspberry Pi

Raspberry Pi OS Desktop (Full Image) — Skip This Step

If you are running Raspberry Pi OS Desktop (the full image), a desktop environment is already installed and running. Proceed directly to Step 2.

Raspberry Pi OS Lite — Install XFCE

If you are running Raspberry Pi OS Lite (headless, no desktop), install a lightweight desktop environment first:

sudo apt update
sudo apt install -y xfce4 xfce4-goodies

XFCE is recommended for Raspberry Pi because it is lightweight and runs well on all Pi models including Pi Zero 2W and Pi 3.

Step 2: Install and Configure xRDP on Raspberry Pi

Install xRDP

sudo apt update
sudo apt install -y xrdp

Start and Enable xRDP

sudo systemctl start xrdp
sudo systemctl enable xrdp
sudo systemctl status xrdp

Verify xRDP Is Listening on Port 3389

$ ss -tlnp | grep 3389
LISTEN  0  10  0.0.0.0:3389  0.0.0.0:*  users:(("xrdp",pid=1234,fd=7))

Configure xRDP to Use XFCE (Lite Image Only)

If you installed XFCE in Step 1, configure xRDP to launch it:

echo "startxfce4" > ~/.xsession
sudo systemctl restart xrdp

Test Locally (Optional)

Confirm xRDP works on your local network before setting up the remote tunnel. From a device on the same network, open Remote Desktop Connection and enter the Pi’s local IP address (e.g., 192.168.1.42) with port 3389.

Step 3: Install the SocketXP Agent on Your Raspberry Pi

SocketXP is a cloud-based IoT Remote Access and device management platform that creates secure SSL/TLS reverse proxy tunnels — letting you reach any TCP service on the Pi from anywhere, without opening inbound firewall ports.

Step 3.1: Download and Install

Follow the download and install instructions to install the SocketXP agent on your Raspberry Pi. The agent supports arm (32-bit) and arm64 (64-bit) for all Pi models.

Step 3.2: Get Your Authentication Token

Sign up at the SocketXP Web Portal and retrieve your authentication token.

SocketXP Portal Authentication Token - Raspberry Pi xRDP Remote Desktop Access

Authenticate the agent:

$ socketxp login [your-auth-token-goes-here]

Step 3.3: Create the xRDP Tunnel

$ socketxp connect tcp://localhost:3389

Connected to SocketXP Cloud Gateway.
Access the TCP service securely using the SocketXP agent in IoT Slave Mode.

Your Raspberry Pi now appears in the SocketXP portal Devices list.

SocketXP Web Portal - Raspberry Pi listed online and ready for xRDP remote desktop access

Security note: SocketXP does not expose port 3389 to the public internet. The tunnel endpoint is private — accessible only via the SocketXP agent in slave mode using your auth token. Port scanners cannot discover or reach your Pi’s RDP port.

Run SocketXP as a systemd Service

For persistent tunneling across reboots, configure SocketXP as a systemd service using the single-touch installation command from the SocketXP portal. This ensures the RDP tunnel is always available when the Pi is powered on.

Step 4: Set Up SocketXP Slave Mode on Your Access Device

On the Windows PC or Mac you will use to connect, install the SocketXP agent and run it in slave mode to create a local TCP proxy to the Pi’s xRDP port.

$ socketxp connect tcp://localhost:3000 \
    --iot-slave \
    --peer-device-id "your-raspberry-pi-device-id" \
    --peer-device-port 3389 \
    --authtoken your-auth-token

Listening for TCP connections at:
Local URL -> tcp://localhost:3000

Find your Raspberry Pi’s device ID in the SocketXP portal under Devices.

SocketXP now listens on localhost:3000 on your access device. Any RDP connection to that port is securely tunneled to port 3389 (xRDP) on your Raspberry Pi.

Step 5: Connect to Raspberry Pi Remote Desktop

From Windows — Remote Desktop Connection (Built-in)

Windows 10 and Windows 11 include Remote Desktop Connection (RDC). No third-party software needed.

  1. Press Win + R, type mstsc, press Enter — or search “Remote Desktop Connection” in the Start menu
  2. In the Computer field, enter: localhost:3000
  3. Click Connect
  4. Enter your Raspberry Pi username and password when prompted
Windows Remote Desktop Connection to Raspberry Pi via xRDP and SocketXP

The Raspberry Pi desktop appears in your Windows RDP session.

From Mac — Microsoft Remote Desktop

  1. Install Microsoft Remote Desktop from the Mac App Store (free)
  2. Click Add PC, set PC name to localhost:3000
  3. Under User account, add your Raspberry Pi username and password
  4. Double-click the connection to launch

From Linux — Remmina

sudo apt update && sudo apt install remmina

Open Remmina, create a new connection with protocol RDP, server localhost, port 3000, and your Pi credentials.

What You See After Connecting

Once connected, you have a full graphical session on your Raspberry Pi — the complete XFCE or Raspberry Pi OS desktop. You can run applications, edit files, open a terminal, configure settings, and perform any task you would do in person.

Raspberry Pi desktop accessed remotely via xRDP and SocketXP over the internet

xRDP vs VNC for Raspberry Pi Remote Desktop

Both xRDP and VNC provide graphical desktop access to a Raspberry Pi. The right choice depends on your use case:

CriterionxRDPVNC (RealVNC / TightVNC)
Windows clientBuilt-in (RDC) — no installRequires VNC viewer download
Mac clientMicrosoft Remote Desktop (free, App Store)Built-in Screen Sharing or VNC viewer
Linux clientRemminaMany options (Remmina, TigerVNC, etc.)
ProtocolMicrosoft RDPVNC protocol
Performance on WindowsGenerally smootherGood, but more bandwidth
Audio redirectionSupportedLimited
Multi-monitor supportYesLimited
Pre-installed on Pi OS DesktopNo (install needed)RealVNC pre-installed

For Windows-primary teams, xRDP is the better choice — no software to install on the Windows side. For cross-platform teams (Windows + Mac + Linux + mobile), VNC is more universal. Both work identically with SocketXP’s tunnel.

Why SocketXP Outperforms Tailscale and ngrok for Raspberry Pi xRDP Access

CriterionngrokTailscaleSocketXP
Works behind CGNATYesYes (DERP relay)Yes
RDP session time limitsYes (free tier)NoNo
IoT fleet managementNoNoYes
OTA firmware updatesNoNoYes
Device monitoringNoNoYes
Scales to 10,000+ Pi devicesNot designed for IoTMesh complexityNative IoT architecture
VPN client on access deviceNoYesNo
Lightweight agent on PiYesModerate (kernel VPN)Minimal userspace binary

ngrok is a developer tunneling tool — it is not designed for persistent xRDP sessions or IoT fleet management. Free tier sessions time out and URLs change on restart.

Tailscale requires installing a VPN client on every Windows PC or Mac that needs to connect to the Pi. For field engineers or support staff using personal machines, this is impractical. Tailscale also provides no IoT-specific features.

SocketXP requires no VPN client on the access device — only the lightweight slave mode agent to create a local proxy, and SocketXP then manages the secure tunnel. As an IoT Remote Access and Device Management platform, it scales to tens of thousands of Raspberry Pi devices with centralized SSH, xRDP, OTA updates, monitoring, and RBAC from a single portal.

Security Best Practices

  • Never expose port 3389 to the internet directly — RDP is one of the most heavily attacked protocols online; SocketXP’s tunnel keeps it private
  • Use strong passwords for your Raspberry Pi user account, as these are the RDP credentials
  • Disable unused accounts — only the accounts that need xRDP access should be active on the Pi
  • Keep xRDP and Raspberry Pi OS updated (sudo apt update && sudo apt upgrade) to patch known xRDP vulnerabilities
  • Use SocketXP RBAC to restrict which team members can access the Pi’s xRDP session
  • Run SocketXP as a systemd service to ensure the tunnel auto-reconnects after reboots and network disruptions
  • Monitor xRDP logs via journalctl -u xrdp for suspicious login attempts

Conclusion

Remote desktop access to a Raspberry Pi over the internet is practical and secure with the xRDP + SocketXP combination. xRDP provides a full graphical desktop session compatible with Windows RDC, Microsoft Remote Desktop on Mac, and Remmina on Linux. SocketXP’s outbound tunnel eliminates the need for port forwarding, a static IP, or a VPN — making xRDP accessible from anywhere, even behind CGNAT.

For the complete Raspberry Pi remote access solution — SSH, VNC, xRDP, web apps, headless setup, and platform-specific guides — see the full SocketXP solution page.

Frequently Asked Questions (FAQs)

General FAQs About IoT Remote Access

What is IoT remote access and why is it important?

IoT remote access allows you to securely connect to and manage devices (like Raspberry Pi, ESP32, BeagleBone, or industrial gateways) over the internet. It’s essential for developers and enterprises to update firmware, debug issues, monitor logs, or control devices deployed in remote locations without physically being there.

Why is remote access to microcontroller boards or embedded Linux devices challenging?

Most IoT devices sit behind NAT routers or firewalls, making them unreachable directly over the internet. Setting up port forwarding or static IPs can be complex and insecure. Solutions like SocketXP remove these hurdles by providing secure tunneling without reconfiguring networks.

How does SocketXP make remote IoT access easier compared to VPNs or port forwarding?

Unlike VPNs, SocketXP doesn’t require complex setup, static IPs, or exposing open ports. It creates a secure, lightweight tunnel between your device and your laptop/browser, so you can access it instantly without worrying about firewall restrictions.

Security & Networking FAQs

Is Raspberry Pi xRDP remote access safe?

It is safe when accessed via SocketXP. The SocketXP tunnel keeps port 3389 private — it is never exposed to the internet or visible to port scanners. All traffic is encrypted with SSL/TLS. Never use port forwarding for xRDP, as port 3389 is one of the most aggressively scanned ports on the internet.

What are the risks of exposing xRDP port 3389 via port forwarding?

Port 3389 exposed to the internet receives continuous automated brute-force attacks. Attackers use credential stuffing tools that try thousands of username/password combinations per minute. SocketXP eliminates this exposure entirely by keeping port 3389 private.

How does SocketXP ensure secure remote connections?

SocketXP uses end-to-end encrypted tunnels (TLS 1.2/1.3), token-based authentication, and allows fine-grained access control. It ensures that only authorized users can connect, keeping devices safe from cyberattacks.

Device & Platform-Specific FAQs

Can I use Windows Remote Desktop Connection to access Raspberry Pi?

Yes. With SocketXP slave mode running on your Windows machine (creating a local proxy on localhost:3000), open RDC and connect to localhost:3000. Enter your Raspberry Pi username and password. No extra RDP software is needed on Windows.

Which Raspberry Pi models support xRDP remote desktop?

All Raspberry Pi models that can run a desktop environment — Pi Zero 2W, Pi 3, Pi 4, Pi 5 — are supported. xRDP is more demanding than SSH; the Pi 4 and Pi 5 provide the smoothest xRDP desktop experience. The SocketXP agent provides arm and arm64 binaries for all models.

Can I access Raspberry Pi desktop from a Mac using xRDP?

Yes. Install Microsoft Remote Desktop (free) from the Mac App Store, configure it to connect to localhost:3000, and enter your Pi credentials. The Raspberry Pi desktop session appears in the RDP window on your Mac.

Pricing & Business FAQs

Is SocketXP free to use?

SocketXP offers a free tier for developers and hobbyists with limited devices. Paid plans unlock more devices, features, and enterprise support.

Does SocketXP offer a free trial for IoT developers?

Yes. You can try SocketXP for free and later upgrade to paid plans as your deployment grows.

Can I use SocketXP for commercial IoT products?

Yes. SocketXP supports enterprise deployments, OEM integrations, and white-label options for commercial products.

SocketXP IoT Remote Access and Device Management Platform

Remotely access, manage, and update your IoT & AIoT edge fleet with SocketXP's secure and scalable platform.

Start Your Free Trial Now!

Join thousands of satisfied users who trust SocketXP for a secure, reliable, and scalable IoT Edge device management solution. Start your free trial now.