100tiao1: How-to instructions you can trust. Linux How to Enable Remote Desktop Access With xrdp on Raspberry Pi

How to Enable Remote Desktop Access With xrdp on Raspberry Pi

It’s fairly common to connect remotely to the Raspberry Pi via the Secure Shell Protocol (SSH). The problem with SSH is that it only lets you connect to your Pi’s shell. What if you want to remotely enjoy the full desktop experience? That’s where xrdp comes in. Here is how you can set up xrdp on your Pi so you can connect to it remotely from any Windows, Mac, or Linux computer, as well as iOS and Android mobile devices.

Content

What Is xrdp and How Does It Work?

xrdp is an open-source implementation of Microsoft’s Remote Desktop Protocol (RDP) that lets you connect to your Linux machines using the same protocol you’d use for Windows remote desktop connections.

There are two components to any xrdp setup: the xrdp server running on your Raspberry Pi and a Remote Desktop client on the device you want to connect from. If you’re using Windows, then you probably already have the client installed, and there are third-party clients for all other major platforms.

By default, xrdp protects all your remote sessions using TLS (Transport Layer Security) encryption, so you don’t have to worry about someone snooping on your connection. This encryption covers everything from your mouse movements to file transfers and even clipboard contents.

Now, xrdp isn’t the only solution of its kind. Another popular option is VNC (Virtual Network Computing), which is included in Raspberry Pi OS. However, I have found RDP performs significantly better than VNC. When I’m remotely connected to my Pi using xrdp, I barely notice any lag when performing regular tasks like web browsing or OS configuration, which is something I really can’t say about VNC.

Install and Configure the xrdp Server on Pi

The first thing you’ll need to do is open up your terminal and run:

sudo apt install xrdp

This command will download and install the xrdp package along with all its dependencies.

After the installation is complete, there’s a small but important step that I learned about the hard way – you need to add the xrdp user to the ssl-cert group so that xrdp can properly handle secure connections. Just run sudo adduser xrdp ssl-cert, and you’re good to go.

If you’re running the latest version of the Raspberry Pi OS, then the default configuration will most likely result in display issues (your screen will be completely black). The fix is actually quite simple:

Open up the xorg configuration file:

sudo nano /etc/X11/xrdp/xorg.conf

Once you’re in the configuration file, you’ll need to look for a line that contains Option “DRMDevice” (you can press Ctrl + W in nano to search for “DRMDevice”). When you find it, you’ll want to change it to:

Option "DRMDevice" ""

Press Ctrl + X to quit the editor (don’t forget to press Y to save the changes).

After making these changes, restart your Pi, and your xrdp server should be configured and ready to accept connections (it will launch automatically after every boot).

Connecting to Your Pi’s xrdp Server

With the xrdp server up and running on your Pi, you can now connect to it from virtually any device – you just need a Remote Desktop client for your platform.

  • For Windows users, the built-in Microsoft Remote Desktop app is your best bet, and you can grab the latest version from the Microsoft Store.
  • If you’re on macOS, you’ll want to download Windows App from the App Store.
  • Android users can get the Remote Desktop app from the Play Store.
  • iOS users should look for Windows App Mobile in the App Store.
  • If you’re running Linux, then you can use Remmina, a free and open-source client that handles RDP connections beautifully through its plugin system.

The good news is that the process is remarkably similar regardless of which client you’re using. For example, in macOS, I can just click the Plus icon and choose to add a new PC.

Enter your Pi’s local IP address in the PC name field (if you’re not sure what the address is, then just enter ifconfig in your Pi’s terminal). You can also give your connection a friendly name like “Workshop Pi” or “Media Pi” in the Friendly name field. Once you’ve filled in these details, click Add, and you should see your new connection appear in the list. Double-click it, and if everything’s set up correctly, you’ll be greeted by your Pi’s desktop environment.

To avoid future headaches, I strongly recommend reserving a static IP address for your Pi in your router’s settings. That way, you won’t have to modify your connection settings every time your router decides to shake things up by giving your Pi a new IP address, which can happen after a router restart.

Now that you can comfortably control your Raspberry Pi remotely from any device, you’ll find it easy to run your own local LLM on it, turn it into a Discord radio station, set up a self-hosted photo gallery, and much more.

Cover image by DALL-E. Screenshots by David Morelo.


David Morelo
Staff Writer

David Morelo is a professional content writer in the technology niche, covering everything from consumer products to emerging technologies and their cross-industry application. His interest in technology started at an early age and has only grown stronger over the years.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe

Related Post