The Raspberry Pi is a versatile mini-computer that can run a full operating system. By setting up remote desktop access with XRDP, you can control your Raspberry Pi from any Windows PC on your network. This allows you to use your Pi without needing a separate monitor, keyboard and mouse connected to it directly.
XRDP is an open-source implementation of Microsoft’s Remote Desktop Protocol (RDP) that enables remote connections to Linux machines like the Raspberry Pi. It provides better performance than VNC, with minimal lag when browsing the web or configuring the operating system remotely.
Installing XRDP on Your Raspberry Pi
Step 1: Update your Raspberry Pi’s software. Open a terminal window and run these commands:
sudo apt update
sudo apt upgrade
Step 2: Install the XRDP package by entering this command:
sudo apt install xrdp
If you get a “username is not in the sudoers file” error, you’ll need to add your user to the sudo group. Log in as the root user with su root, then edit the sudoers file with nano /etc/sudoers. Add the line username ALL=(ALL) ALL under the “Allow members of group sudo to execute any command” section, replacing “username” with your actual username.
Step 3: Create a new user account for remote desktop access. The default Pi user won’t work with XRDP. Use this command, replacing USERNAME with your chosen name:
sudo adduser USERNAME
Step 4: Find your Raspberry Pi’s IP address by running:
hostname -I
Make note of the IP address displayed – you’ll need it to connect remotely.
Connecting to Your Raspberry Pi Remotely
Step 1: On your Windows PC, open the built-in Remote Desktop Connection app. You can find it by searching for “rdp” in the Start menu.
Step 2: In the “Computer” field, enter the IP address of your Raspberry Pi that you noted earlier.
Step 3: Click “Connect” and you’ll be prompted to enter login credentials. Use the username and password for the new account you created specifically for XRDP access.
Step 4: After authenticating, you should see the Raspberry Pi’s desktop environment in the Remote Desktop window. You can now control your Pi as if you were sitting in front of it with a monitor and keyboard connected.
Troubleshooting XRDP Connections
If you have trouble connecting, try these steps:
- Ensure the XRDP service is running on the Pi with:
sudo systemctl status xrdp - Check that the Pi’s firewall allows RDP connections on port 3389.
- Verify you’re using the correct IP address for the Pi.
- Try rebooting both the Raspberry Pi and your Windows PC.
For users on other operating systems, there are RDP clients available:
- Mac: Microsoft Remote Desktop from the App Store
- Linux: Remmina or FreeRDP
- iOS/Android: Microsoft Remote Desktop mobile app
With XRDP set up, you can now access your Raspberry Pi’s desktop from anywhere on your local network. This makes it much more convenient to use your Pi for various projects without needing a dedicated monitor and input devices.