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:
  xorgxrdp
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)
           man:xrdp.ini(5)
 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 127.0.0.1/8 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 172.16.8.177/24 brd 172.16.8.255 scope global dynamic noprefixroute ens33

My ip address is 172.16.8.177. 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:

Alain Francois 12:25 pm

About Alain Francois

IT Linux administrator passionate of free and open source software, I work on Linux Systems since some years on installations and deployments of certain solutions. I like to share my experiences with a wider audience by training and conferences.

Author's All Posts
Like to become part of Linoxide Team and contribute tips? Contact us here.

Comments

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

All comments are subject to moderation.

2 Comments

  1. I prefer X2GO. It handles true separate X sessions via ssh, which you can continue also. It has Windows client also.