- Different remote access options
- Step-by-step setup of RDP using xrdp
- How to use VNC for remote control
- Setting up SSH for command line access
- How to access your Pi over the internet using TCP tunneling
What You’ll Learn
- How to set up and configure remote desktop connections
- Fast and smooth methods for connecting from Windows to Raspberry Pi
- Steps to fix common issues
- Tips to keep your system secure and responsive
Introduction to Remote Access Options for Raspberry Pi
Remote access lets you run your Pi without a monitor, keyboard, or mouse at all times. This setup saves desk space and makes your projects very flexible. You can use this guide whether you build home servers, automation systems, or IoT projects, including the Raspberry Pi Python projects you want to run headless. Every method below assumes the Pi is already on your network; if it is not, start with our guide to setting up WiFi on a Raspberry Pi. When you work on your projects, you often need headless control. This guide shows you how to do that using different tools. The main methods include:- Remote Desktop Protocol (RDP) using xrdp
- Virtual Network Computing (VNC)
- Secure Shell (SSH) for command line access
- Cloud and tunneling solutions for internet access
Understanding Remote Access Methods
Remote Desktop Protocol (RDP)
RDP is made by Microsoft. It creates a virtual screen on your Pi and works well with Windows. RDP is fast and uses less system power.Virtual Network Computing (VNC)
VNC shows the real screen of your Pi. It comes with many Raspberry Pi systems. It works on multiple platforms but can feel slower than RDP.Secure Shell (SSH)
SSH lets you access your Pi via a command line. This method uses minimal system power. SSH is great for advanced users who are comfortable with the terminal. Once it works, you can also use it to push wireless OTA updates from the Pi to an Arduino.Cloud and TCP Tunneling Solutions
If your Pi is behind a firewall or NAT, these methods help you reach it using internet services. They provide a public address without the need for manual port changes.Method 1: Using RDP (xrdp) for Fast Remote Access
Why Use RDP?
RDP works smoothly on Windows. It creates a virtual desktop for the Pi. It feels responsive and uses system resources well.Step-by-Step Guide to Install xrdp
- Update your Raspberry Pi:
sudo apt update && sudo apt upgrade -y
This makes sure your system is current.
- Install xrdp:
sudo apt install xrdp -y
- Start the xrdp Service:
sudo systemctl start xrdp
- Enable xrdp at Boot:
sudo systemctl enable xrdp
- Get the IP Address:
hostname -I
Write down the IP address. You will use it to connect from Windows.
Optimizing xrdp Performance
You might wish to adjust the xrdp settings. Open the configuration file:sudo nano /etc/xrdp/xrdp.ini
Change the color settings by setting max_bpp=32. You can also set crypt_level=high for better safety.
If you face display issues, check the GPU setting in the boot file:
sudo nano /boot/config.txt
Comment out lines with certain GPU overlays if you see problems. Save the file and restart your Pi.
Connecting from Windows Using RDP
- Press the Windows key and R.
- Type
mstscand hit Enter. - In the Remote Desktop window, type your Pi’s IP address.
- Click “Connect” and then enter your username (often “pi”) and password.
sudo systemctl status xrdp
Also check port 3389 with:
sudo netstat -tuln | grep 3389
Method 2: Using VNC for Cross-Platform Remote Access
Setting Up the Built-In VNC Server
- Enable VNC on Your Pi:
sudo raspi-config
Go to Interface Options and select VNC. Choose Enable and then restart if needed.
- For Headless Use:
sudo nano /boot/config.txt
Add these lines:
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=16
This forces the Pi to create a virtual display.
- Set a Virtual Resolution:
framebuffer_width=1920
framebuffer_height=1080
Save and exit.
Connecting with VNC Viewer on Windows
- Download VNC Viewer from the official site.
- Install and open VNC Viewer.
- Enter your Raspberry Pi’s IP address.
- Provide your username and password.
Using RealVNC Connect for Internet Access
- Create an account on the RealVNC website.
- Sign into VNC Server on your Pi.
- Install and sign into VNC Viewer on your Windows computer using the same account.
- Your Pi will appear in the device list automatically, letting you connect from anywhere.
Method 3: Using SSH Command Line Remote Access
Enabling SSH on Your Pi
SSH is usually enabled via raspi-config. Use the following command:sudo raspi-config
Select Interface Options, then SSH, and choose Enable. Alternatively, you can create an empty file named “ssh” on the SD card boot partition. If you want to link the Pi straight to a laptop with an Ethernet or USB cable instead of over WiFi, see how to connect a Raspberry Pi to a laptop with SSH, VNC, Ethernet or USB.
Connecting via SSH from Windows
There are two main ways to use SSH on Windows:Via Windows Terminal or PowerShell
Open the terminal and type:ssh pi@YOUR_PI_IP_ADDRESS
Replace “YOUR_PI_IP_ADDRESS” with the actual IP obtained earlier.
Via PuTTY
- Download PuTTY.
- Enter your Pi’s IP address and set the port to 22.
- Click “Open” and then provide your username and password.
Log In with an SSH Key Instead of a Password
Key-based login is safer than a password and saves typing. On Windows 10 or 11, open PowerShell and create a key pair:ssh-keygen -t ed25519
Windows has no ssh-copy-id command, so copy the public key to the Pi with:
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh pi@YOUR_PI_IP_ADDRESS "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Log in again with ssh pi@YOUR_PI_IP_ADDRESS. If you get in without a password prompt, you can turn off password logins on the Pi. Open the SSH server config:
sudo nano /etc/ssh/sshd_config
Set this line:
PasswordAuthentication no
Then restart SSH:
sudo systemctl restart ssh
Keep the private key (id_ed25519, the file without .pub) on your PC and never share it.
Edit Files on the Pi from VS Code
Visual Studio Code on Windows can open folders on the Pi over SSH. Install the Remote – SSH extension, press F1, run Remote-SSH: Connect to Host… and enterpi@YOUR_PI_IP_ADDRESS. VS Code then works with files and a terminal on the Pi as if they were on your PC.
Enabling GUI via SSH
If you want to run GUI apps remotely:- Install X11 forwarding on the Pi:
sudo apt install xauth
- On your Windows computer, install an X server like VcXsrv or Xming.
- Connect with:
ssh -X pi@YOUR_PI_IP_ADDRESS
- To open a GUI application, type for example:
firefox &
This setup lets you run apps on your Pi and see them on your PC.
Method 4: Accessing Raspberry Pi Remotely Over the Internet
Sometimes, your Pi sits behind a firewall or a private network. In such cases, you can use a tunneling service. For more options in this situation, read our guide to accessing a Raspberry Pi behind a router from Windows 10.Using a TCP Tunnel Service (e.g., Pinggy TCP Tunneling)
- Install xrdp on your Raspberry Pi:
- Create a TCP Tunnel:
ssh -p 443 -R0:localhost:3389 tcp@a.pinggy.io
This creates a tunnel and gives you a URL and port. Write these down.
- Connect with Remote Desktop:
- Set Up Auto-Reconnect:
while true; do
ssh -p 443 -o ServerAliveInterval=30 -R0:localhost:3389 tcp@a.pinggy.io
sleep 10
done
This command restarts the connection if it drops.
Using a tunnel allows you to work from anywhere without changing router settings or exposing ports.
Other Remote Desktop Options
If xrdp, VNC or SSH don’t suit your setup, these tools also put the Pi desktop on your Windows PC.Raspberry Pi Connect
Raspberry Pi Connect is the official remote access service from Raspberry Pi. It gives you the Pi desktop or a command line in your browser. Install it with:sudo apt update
sudo apt full-upgrade
sudo apt install rpi-connect
sudo reboot
After the reboot, sign up at connect.raspberrypi.com and link your Pi by clicking the Connect icon. On older models, Connect Lite offers command line access only.
NoMachine and AnyDesk
NoMachine is a good pick when you need clear graphics and smooth video, and it supports file transfers. AnyDesk is a light option for quick remote help. For both, download the Raspberry Pi package from the vendor’s website and install it on the Pi withsudo dpkg -i followed by the package file name. Then install the client on Windows and connect with the Pi’s IP address (NoMachine) or its AnyDesk ID.
Troubleshooting Common Issues
Even the best setups sometimes face hiccups. Here are some tips:- Connection Denied: Confirm that the service (xrdp or VNC) runs on your Pi. Use:
sudo systemctl status xrdp
- Black Screen on RDP: Try restarting the xrdp service:
sudo systemctl restart xrdp
Also, check your monitor settings in the configuration file.
- Display Problems in Browsers: If browser windows look off, disable GPU acceleration in your Pi’s boot file. You may need to comment out certain overlay lines.
- SSH Timeouts: Increase the server alive interval with SSH options.
- VNC Slow Response: Reduce color depth or adjust picture quality in VNC settings.
Quick Tip: Always check your Pi’s IP address before connecting. To stop it from changing, set a DHCP reservation for the Pi on your router, or connect by its hostname, such as raspberrypi.local.These fixes work for many common issues. Adjust settings incrementally and test the changes.
Security Best Practices
Keep your connections secure with these tips:- Use strong, unique passwords for your Pi user.
- Change default usernames if possible.
- When using SSH, set up key-based authentication for extra safety.
- For cloud-based access, use services that automatically provide end-to-end encrypted links.
- Regularly update your Pi and remote access software.
Note: Do not leave your remote access ports open to the public without proper security.A secure setup protects your projects and your network from unwanted access.
Remote Access on Newer Raspberry Pi OS Versions
Many remote desktop guides were written for older Raspberry Pi OS releases, so a few details in them no longer match what you see on a fresh install. If a step above does not behave as described, check these points first.
- The username is not always “pi”. Recent versions of Raspberry Pi OS ask you to create a user during first setup, and the Raspberry Pi Imager lets you set one before you write the card. Use that username in mstsc, VNC Viewer, PuTTY and the
sshcommand. - The boot file may have moved. On newer releases the config file is usually at
/boot/firmware/config.txtinstead of/boot/config.txt. If the old path does not exist or your edits have no effect, look in the new location. - The desktop session type matters. Newer releases can run a Wayland desktop by default, while xrdp and some VNC setups were built around X11 sessions. If you get a black screen or no desktop after logging in, open
sudo raspi-configand look under the Advanced Options for the display or Wayland setting. Switch to X11, then reboot and try again. - Log out of the Pi first. If the same user is already signed in on the Pi’s own screen, xrdp may refuse to start a second session and leave you with a black screen. Sign out locally, or use a different account for remote logins.
- A firewall can block RDP. If you turned on a firewall such as ufw, allow port 3389 for RDP, 22 for SSH and 5900 for VNC. Only do this on your local network, and do not forward these ports on your router.
Which method should you start with? For a full desktop from a Windows PC on the same network, try xrdp and the built-in Remote Desktop Connection app. If you only need a terminal, SSH is the simplest and lightest. If you want to see exactly what is on the Pi’s screen, use VNC. If any of these fail, SSH is a good fallback, because you can log in and read the service status and logs to find out why.