This tutorial explains how to install XRDP (X Remote Desktop Protocol) to graphically connect to a Linux device from a Microsoft Windows device.

Set up your firewall for XRDP

XRDP uses port 3389. Before installing XRDP, you need to open this port. You can open the port using UFW (Uncomplicated Firewall), as shown in the example below. Replace the IP address for your network address.

sudo ufw allow from 10.0.2.0/24 to any port 3389

Then reload UFW as shown in the following image.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-01.png" data-lazy- height="258" src="data:image/svg xml,” width=”939″>

Now your firewall is ready to use XRDP.

Getting started with XRDP

On Debian and its Linux distributions, you can install XRDP using apt, as shown in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-02.png" data-lazy- height="577" src="data:image/svg xml,” width=”939″>

XRDP installation process will add the user xrdp to your system. To allow authentication, you need to add the xrdp user to the ssl-cert group. You can achieve this using the usermod command, as shown in the screenshot below.

sudo usermod -a -G ssl-cert xrdp

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-03.png" data-lazy- height="233" src="data:image/svg xml,” width=”939″>

Once added the user to the group, restart the xrdp service; you can use systemctl as shown below.

sudo systemctl restart xrdp

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-04.png" data-lazy- height="122" src="data:image/svg xml,” width=”939″>

Now you are ready to connect through XRDP.

Connecting from Windows to Linux using XRDP

On Windows, look for the RDP application; you can use the Applications search box as shown in the following screenshot.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-05.png" data-lazy- height="568" src="data:image/svg xml,” width=”939″>

A window will prompt asking for the IP address of the Linux device you want to connect to, fill it and press the OK button.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-06.png" data-lazy- height="764" src="data:image/svg xml,” width=”939″>

When trying to connect, you will see a warning. If you don’t want the warning to appear again, you can check the “Don’t ask me again for connections to this computer” box, then press the Yes button to continue.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-07.png" data-lazy- height="708" src="data:image/svg xml,” width=”939″>

A login box will show up; fill in your username and password. It is important to remember you won’t be able to connect to your Linux device with a username already logged in your Linux device, use a different user, or logout from your Linux computer.

After filling in your username and password, press the OK button.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-08.png" data-lazy- height="641" src="data:image/svg xml,” width=”939″>

As you can see, the connection was done successfully.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-09.png" data-lazy- height="575" src="data:image/svg xml,” width=”939″>

Troubleshooting

When I tried to connect using XRDP with MATE windows manager on my Linux device, I got a DBUS error followed by a black screen. To solve this, you can change your window manager or follow the steps described below.

Edit the configuration file /etc/xrdp/startwm.sh; you can use nano as shown below.

sudo nano /etc/xrdp/startwm.sh

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-10.png" data-lazy- height="308" src="data:image/svg xml,” width=”939″>

Add the following 2 lines to the file before the two final lines, as shown in the screenshot below.

Unset DBUS_SESSION_ADDRESS


Unset XDG_RUNTIME_DIR

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-11.png" data-lazy- height="600" src="data:image/svg xml,” width=”939″>

Restart XRDP as shown below.

sudo systemctl restart xrdp

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-12.png" data-lazy- height="122" src="data:image/svg xml,” width=”939″>

Now you must be able to connect from Windows to Linux using xrdp.

For additional information on XRDP, you can read this link https://linux.die.net/man/8/xrdp.

Connect Linux/Windows devices using TeamViewer

TeamViewer is one of the most popular tools for remote access to devices. It supports multiple operating systems allowing you to connect from Windows to Linux. The main problem is TeamViewer isn’t open-source, and it’s free only for personal use.

This section includes instructions both for Linux and Windows sides.

Instructions for the Linux device

To begin, on your Linux device, download TeamViewer from this link https://www.teamviewer.com/en-us/download/linux/

At the bottom of the page, you’ll see the proper installation package for Debian-based Linux distributions, such as Ubuntu, press on your proper architecture to start downloading.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-13.png" data-lazy- height="456" src="data:image/svg xml,” width=”939″>

Once downloaded, install teamviewer by running the command below. Remember to replace “teamviewer_15.21.4_amd64.deb” with your proper file name or correct version.

sudo dpkg -i teamviewer_15.21.4_amd64.deb

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-14.png" data-lazy- height="314" src="data:image/svg xml,” width=”939″>

Once installed, you can find TeamViewer on your Applications menu; press it to open the program in the Internet section.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-15.png" data-lazy- height="677" src="data:image/svg xml,” width=”377″>

When TeamViewer shows up, you’ll see “Your ID” and “Password” on your left side; you will need that information later, don’t copy it now since the password refresh after a couple of minutes.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-16.png" data-lazy- height="585" src="data:image/svg xml,” width=”939″>

Instructions for the Windows device

On Windows, click this link to Download TeamViewer  https://teamviewer.com/en-us and press the “Download for free” button.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-17.png" data-lazy- height="506" src="data:image/svg xml,” width=”939″>

The download will start automatically.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-18.png" data-lazy- height="643" src="data:image/svg xml,” width=”939″>

If the installer doesn’t start automatically, run it and select the “Default Installation” as shown below, then press the “Accept – next” button.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-19.png" data-lazy- height="668" src="data:image/svg xml,” width=”779″>

When requested, allow TeamViewer to make changes on your devices by pressing the “Yes” button.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-20.png" data-lazy- height="512" src="data:image/svg xml,” width=”712″>

Wait for the first part of the installation process to end.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-21.png" data-lazy- height="662" src="data:image/svg xml,” width=”768″>

When asked, select the option “I want to use the free version for personal use” and press the “Finish” button.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-22.png" data-lazy- height="668" src="data:image/svg xml,” width=”775″>

On the next window, mark the “I accept the EULA and the DPA” box and press “Continue“.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-23.png" data-lazy- height="714" src="data:image/svg xml,” width=”937″>

TeamViewer will show up. On the “Partner ID” field, type the code TeamViewer on your Linux device shows in the “Your ID” section.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-24.png" data-lazy- height="675" src="data:image/svg xml,” width=”939″>

Then you will be asked for the password shown in your Linux device’s TeamViewer “Password” field.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-25.png" data-lazy- height="272" src="data:image/svg xml,” width=”583″>

As you can see in the image below, the connection was done properly. The reason why the screenshot below seems messy is that for this tutorial, I’m using a virtual machine.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/Xrdp-configuration-Debian-26.png" data-lazy- height="529" src="data:image/svg xml,” width=”939″>

That’s all for now; you just learned two different ways to connect from Windows to Linux.

Conclusion

As you can see, setting up xrdp on Debian to connect from a Windows device is pretty easy. Any Linux user level can apply the steps explained in this tutorial to achieve a connection between different operating systems. As shown, Linux supports several methods to accept connections from Windows. To connect to it, this tutorial explained two of the most popular ways. Unlike TeamViewer, XRDP is an open-source implementation, which makes this alternative preferred over TeamViewer, which is neither open source nor free for non-personal use. You can find additional solutions, like AnyDesk, whose instructions you can read at https://linuxhint.com/install_anydesk_debian10/.

Thank you for reading this tutorial. I hope it was useful. Keep following us for more Linux tips and tutorials.

About the author

<img data-del="avatar" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/linuxinstitute_icono-150×150.png613ecacd102eb.jpg" height="112" src="data:image/svg xml,” width=”112″>

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.