To enable remote desktop on a Raspberry Pi, you install and start a remote desktop server (such as RealVNC or xrdp) on the Pi, then connect from another computer using a compatible client. This guide covers the two most common methods—VNC and RDP—and walks through setup, security, and troubleshooting.
Why Remote Desktop on a Raspberry Pi?
The Raspberry Pi is a low-cost, low-power computer often used for projects, media centers, or as a small server. A remote desktop lets you access its graphical interface from another machine, which is useful when the Pi is tucked away in a closet, mounted behind a TV, or running headless (without a monitor). Instead of plugging in a display and keyboard, you can control it from your laptop or desktop over the network.
There are two main protocols for this:
- VNC (Virtual Network Computing) – shares the Pi’s screen and lets you interact with it in real time. It works across platforms and is the default on Raspberry Pi OS.
- RDP (Remote Desktop Protocol) – a Microsoft protocol that lets you connect to the Pi using the built-in Windows Remote Desktop client. This is handy if you’re already using RDP for other machines.
Both are free and built into Raspberry Pi OS, so you don’t need to buy anything.
Prerequisites and Preparation
Before you start, make sure you have:
- A Raspberry Pi running Raspberry Pi OS (any recent version, including Bullseye or Bookworm).
- The Pi connected to your network (Ethernet or Wi-Fi).
- A way to access the Pi’s terminal or desktop initially—either with a monitor and keyboard, or via SSH.
- The Pi’s IP address (find it with
hostname -Iin a terminal).
If you’re starting from a fresh install, it’s a good idea to update the system first:
sudo apt update && sudo apt upgrade -y
This ensures you have the latest packages and security fixes.
Method 1: Using RealVNC (Built-in)
Raspberry Pi OS includes RealVNC Server, which is a VNC server. It’s often pre-installed and enabled by default in the full desktop version. To check if it’s running:
- Open a terminal on the Pi.
- Run
sudo systemctl status vncserver-x11-serviced. If it’s active, you’re good. - If not, start it with
sudo systemctl start vncserver-x11-servicedand enable it to start on boot withsudo systemctl enable vncserver-x11-serviced.
On the client machine, install a VNC viewer (RealVNC Viewer, TigerVNC, or Remmina on Linux). Enter the Pi’s IP address, and you’ll be prompted for your Pi username and password.
If you want to access the Pi from outside your local network, you’ll need to configure port forwarding on your router and use the public IP. However, this is risky and not recommended unless you also set up a VPN or use a service like Tailscale. RealVNC also offers cloud connectivity, but that requires creating an account and may have limits.
Method 2: Using xrdp (RDP)
xrdp is an open-source RDP server that works with Windows, macOS, and Linux clients. It’s not installed by default, but it’s in the official repositories.
- Install it with
sudo apt install xrdp. - Once installed, the service starts automatically. Check with
sudo systemctl status xrdp. - On a Windows PC, open the Remote Desktop Connection app (mstsc.exe), type the Pi’s IP address, and click Connect.
- Log in with your Pi username and password.
One thing to note: xrdp creates a new session on the Pi, so if you’re already logged in at the physical console, you’ll see a different desktop. This is fine for most uses, but it means you can’t share the same screen as the local monitor—you get a separate session.
Security Considerations
Remote desktop opens a network port on your Pi, so you should take precautions:
- Change the default password for the
piuser (or whatever user you use). - Use a strong password—at least 12 characters, mixing letters, numbers, and symbols.
- Don’t expose the port to the internet unless you really need to. If you do, use a VPN or SSH tunnel instead of forwarding ports directly.
- Keep the system updated with regular
sudo apt update && sudo apt upgrade. - Consider using SSH keys for remote access, and disable password login for SSH if you’re comfortable.
For VNC, you can also set an authentication password specifically for VNC sessions (different from your user password). RealVNC supports this in its settings.
Common Problems and Fixes
Here are typical issues and how to solve them:
- Connection refused – The server isn’t running. Check the service status and start it.
- Blank screen after connecting – This often happens with VNC when the Pi’s desktop session isn’t fully loaded. Try restarting the Pi or the VNC service.
- Authentication failed – Make sure you’re using the correct username and password. For xrdp, you might need to use the
piuser explicitly. - Slow performance – Over Wi-Fi, VNC can be laggy. Use Ethernet if possible, or lower the resolution/color depth in the VNC client.
- Cannot connect from outside the network – You need port forwarding, but again, use a VPN or SSH tunnel instead.
If you’re using RealVNC and it asks for a license, you may need to enable the free version by running sudo raspi-config, going to Interface Options, and enabling VNC.
Comparison: VNC vs. RDP
| Feature | VNC (RealVNC) | RDP (xrdp) |
|---|---|---|
| Pre-installed | Yes (on full Raspberry Pi OS) | No (install via apt) |
| Client support | Cross-platform (Windows, macOS, Linux, mobile) | Windows built-in, others via clients like Remmina |
| Session type | Shares the physical screen | Creates a separate session |
| Performance | Good on LAN, can be slow over WAN | Generally faster, especially over lower bandwidth |
| Security | Requires VNC password, can use encryption | Uses standard RDP encryption |
For most home users, VNC is simpler because it’s already there. If you’re on Windows and want a snappier experience, xrdp might be better.
Alternatives to Remote Desktop
Sometimes you don’t need a full graphical desktop. Consider these alternatives:
- SSH – For command-line tasks, it’s lightweight and secure. Use
ssh pi@ip_addressfrom any terminal. - SSH with X11 forwarding – Lets you run individual graphical apps over SSH (e.g.,
ssh -X pi@ipthen launch an app). - Web-based desktops – Tools like noVNC or Apache Guacamole give you a browser-based remote desktop, but they’re more complex to set up.
- Headless configuration – If you only need to change settings, use
raspi-configover SSH.
Choose the method that matches your comfort level and the task at hand.
Frequently Asked Questions
How do I find my Raspberry Pi’s IP address?
Run hostname -I in a terminal on the Pi, or check your router’s DHCP client list. If you have a hostname, you can often use raspberrypi.local instead of an IP (e.g., in VNC viewer).
Can I use remote desktop with Raspberry Pi OS Lite?
Raspberry Pi OS Lite doesn’t have a desktop environment, so remote desktop won’t work directly. You can install a lightweight desktop like Xfce and then set up VNC or xrdp, but it’s more involved. If you need a GUI, it’s easier to start with the full desktop image.
Is it safe to expose VNC to the internet?
Generally, no. VNC is not encrypted by default and can be brute-forced. If you need remote access from outside, use a VPN (like WireGuard or Tailscale) or an SSH tunnel. If you must expose it, change the port, use a strong password, and consider using a firewall.
Why does my VNC session show a gray screen?
This often happens when the Pi’s desktop session isn’t fully started. Try rebooting the Pi, or restart the VNC service with sudo systemctl restart vncserver-x11-serviced. Also make sure you’re not already logged in at the physical console in a way that conflicts.
Can I use remote desktop on a Raspberry Pi 5?
Yes, the methods above work on Raspberry Pi 5 as long as you’re running a recent Raspberry Pi OS. The Pi 5 is faster, so remote desktop performance is generally better.
What’s the difference between VNC and SSH?
VNC gives you a graphical desktop, while SSH gives you a text-based command line. SSH is more efficient and secure for tasks like editing files, installing software, or running scripts. Use VNC when you need to interact with GUI applications.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Philips DST7060/20 7000 Series Iron: Specs & Fit
- Coal Fueled Jet Aircraft: Could It Work?675 L
- Word Select Last Line in Paragraph?
- Google Assistant IFTTT Recipes: 7 Useful Automations
- OLED TVs in Dark Rooms: Why They Look Better and When They Don’t
- Disable Turn Off SmartScreen Filter Internet Explorer