Enabling Remote Desktop Access Using XRDP on Raspberry Pi

Enabling Remote Desktop Access Using XRDP on Raspberry Pi
Raspberry Pi Remote Desktop

Connecting to your Raspberry Pi remotely using Secure Shell Protocol (SSH) is a favored approach, but it’s limited to the shell interface. If you wish to access the complete desktop experience from afar, xrdp is the solution you’ll need. Below, we’ll guide you through the process of setting up xrdp on your Raspberry Pi to enable remote desktop connections from Windows, Mac, Linux, as well as mobile devices running iOS and Android.

Understanding xrdp and Its Functionality

xrdp is an open-source tool that implements Microsoft’s Remote Desktop Protocol (RDP), allowing you to remotely access Linux computers using the same RDP protocol that Windows users utilize.

Xrdp Logo

An xrdp setup comprises two main parts: the xrdp server installed on your Raspberry Pi and a Remote Desktop client on your connecting device. If you’re using Windows, the client is likely pre-installed. For other operating systems, various third-party clients are readily available.

One of the great advantages of xrdp is that it encrypts your remote sessions with TLS (Transport Layer Security), ensuring your connection remains secure against eavesdropping. This encryption safeguards all activities, including mouse movements, file transfers, and clipboard contents.

While xrdp is a popular choice, alternatives like VNC (Virtual Network Computing), available in the Raspberry Pi OS, exist. However, in my experience, RDP generally outperforms VNC, offering smoother connectivity for tasks like web browsing or configuring the operating system.

How to Install and Configure the xrdp Server on Your Raspberry Pi

To get started, open your terminal and execute the following command:

This command will install xrdp along with all necessary dependencies.

Sudo Apt Install Xrdp

After installation, there’s a crucial step: adding the xrdp user to the ssl-cert group to enable secure connections. Simply run the command sudo adduser xrdp ssl-cert.

Sudo Adduser Xrdp Ssl Cert

If you’re using the latest Raspberry Pi OS, you may encounter display issues resulting in a blank screen after a default configuration. Fortunately, there’s an easy fix:

Edit the xorg configuration file by entering:

In the configuration file, search for a line containing Option “DRMDevice” (you can use Ctrl + W in nano to find it). Change this line to:

Drmdevice Xorg Config

Press Ctrl + X to exit the editor (make sure to save your changes by pressing Y).

After applying these updates, reboot your Raspberry Pi, and the xrdp server should be ready to accept incoming connections automatically upon boot.

Establishing a Connection to the xrdp Server on Your Pi

With the xrdp server operational on your Raspberry Pi, you can connect from almost any device that has a Remote Desktop client.

  • Windows users can utilize the built-in Microsoft Remote Desktop application, available for download from the Microsoft Store.
  • If you’re on macOS, download the Windows App from the App Store.
  • For Android devices, the Remote Desktop app is available on the Play Store.
  • iOS users can find the Windows App Mobile on the App Store.
  • For Linux-based systems, Remmina is a free and open-source client that efficiently manages RDP connections with its plugin architecture.
Remote Desktop Add Pc

Regardless of the client used, the connection process is similar. For example, in macOS, you would click on the Plus icon to add a new PC.

Remote Desktop Edit Settings

Enter your Raspberry Pi’s local IP address in the PC name field (use ifconfig in your Pi’s terminal to find it). You can also assign a convenient name to your connection, such as “Workshop Pi” or “Media Pi” in the Friendly name field. After entering this information, click Add, and your new connection should appear in the list. Double-click it, and if everything is set up correctly, your Pi’s desktop environment will greet you.

Raspberry Pi Remote Connection Using Xrdp

To prevent issues down the line, I recommend configuring a static IP address for your Raspberry Pi via your router’s settings. This precaution ensures you won’t have to update your connection settings whenever the router assigns a new IP address to your Pi, which can occur after a router restart.

With the ability to control your Raspberry Pi from any device effectively, you can now run a local LLM, create a Discord radio station, set up a self-hosted photo gallery, and explore countless other projects.

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

Source&Images

Leave a Reply

Your email address will not be published. Required fields are marked *