Xrdp - Connect Ubuntu Linux Remote Desktop via RDP from Windows

xrdp linux desktop remote rdp

How often do you access Linux Desktop? What tools do you use to access remote desktop?

Xrdp is an open source tool which allows users to access the Linux remote desktop via Windows RDP. Apart from Windows RDP, xrdp tool also accepts connections from other RDP clients like FreeRDP, rdesktop and NeutrinoRDP. Xrdp is now supporting TLS security layer.

Xrdp Requirement

  • xrdp and xorgxrdp packages
  • Listens on 3389/tcp. Make sure your firewall accepts connections

In this article, I will show how you can remotely connect to Ubuntu Desktop from a Windows machine using Xrdp tool.

1) Installation on Linux

on Ubuntu 18.04

First, you need to install Xrdp on Ubuntu

# apt install xrdp
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
Suggested packages:
  guacamole xrdp-pulseaudio-installer
The following NEW packages will be installed:
  xorgxrdp xrdp
0 upgraded, 2 newly installed, 0 to remove and 256 not upgraded.
Need to get 498 kB of archives.
After this operation, 3,303 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

You have to configure the polkit rule to avoid an authenticate popup after inputting the username and password at the xrdp login screen on windows

# vim /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf 

polkit.addRule(function(action, subject) {
if ((action.id == “org.freedesktop.color-manager.create-device” || action.id == “org.freedesktop.color-manager.create-profile” || action.id == “org.freedesktop.color-manager.delete-device” || action.id == “org.freedesktop.color-manager.delete-profile” || action.id == “org.freedesktop.color-manager.modify-device” || action.id == “org.freedesktop.color-manager.modify-profile”) && subject.isInGroup(“{group}”))
return polkit.Result.YES;

restart the xrdp service

 # systemctl restart xrdp

Then make sure that the service is running

# systemctl status xrdp
● xrdp.service - xrdp daemon
   Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: en
   Active: active (running) since Tue 2018-10-16 02:05:21 WAT; 11min ago
     Docs: man:xrdp(8)
 Main PID: 2654 (xrdp)
    Tasks: 1 (limit: 2290)
   CGroup: /system.slice/xrdp.service
           └─2654 /usr/sbin/xrdp

Now make sure to automatically start the service at the system startup

# systemctl enable xrdp
Synchronizing state of xrdp.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable xrdp

Now you will need to check your ip address because you will need it for the connection

# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:ef:f6:9b brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic noprefixroute ens33

My ip address is So keeps yours it in your mind.

Xrdp works with port 3389 so make sure to open it. UFW is disabled by default so you will need to enable the firewall and create a rule for xrdp

# ufw enable
# ufw allow 3389/tcp

Now you can continue the configuration on windows side

On Centos/Redhat 7

Make sure to install the Epel repositories before

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Now install xrdp packages

# yum update && yum -y install xrdp tigervnc-server

Add a rule in the firewall. On Centos/RedHat is not ufw but firewalld to configure

# firewall-cmd --permanent --zone=public --add-port=3389/tcp

Then reload the firewall

# firewall-cmd --reload

Now enable and restart the xrdp service

# systemctl enable xrdp && systemctl restart xrdp

Check your ip address for the remote connection on Windows

2) Connect from Windows

On your windows machine such as windows 10 in our case, launch the default remote desktop connection tool.

You will need to enter the ip address of your machine and you will be asked to enter the username

Access Remote desktop of Ubuntu/CentOS

Enter the ip address and the username

Now confirm the information and launch the connection. If you are not logged out in local, the remote login would fail.

Now you will be asked for your password

Now confirm your credentials. You can see the IP address of my Ubuntu on the top and the login page. Enter your password and enjoy

Are you aware of any other tools? Please advise us on the comments

Read Also:

12 Comments... add one

  1. It is driving me crazy. I followed all stepts, installed, reinstalled, rebooted etc etc. but every time windows does fail to connect due to a "security error".

    • Hi Jose,
      try to look at the logs on your linux to see what's happening during the connection. Try also to check if the service is working properly, if not reinstall xrdp and tigervnc-server. Make also sure that the port is well opened.

  2. I follow the instruction on this article, but I end up by losing as well my ssh connection to my Ubuntu server after enabling the firewall, as well Xrdp is not working for me, witch mean I lost all connections possible to my server :(
    Any advise on that? how I can connect back to my server ?

  3. Hi
    I followed the steps and everything was installed properly I think. But after connecting from RDP and after log in all I see is a blue screen which doesn't moves ahead. What to do about it.

  4. 1/11/2020 just installed 18.04 and did everything you have without error, when I run the windows client (Remote Desktop Connection) I get the remote console bar at the top of my screen, a black blank screen, then I'm dropped back to the Windows Remote Desktop Connection pop up on my workstation..

  5. Can you provide a ls of your localauthority.conf.d folder? Did you create the colord file or was it already there? I only have 2 files in that folder 50-localauthority.conf and 51-ubuntu-admin.conf.


Leave a Comment