How to Configure XRDP in Ubuntu and Centos

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 REQUIREMENTS

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

 

1. Installling on Ubuntu 18.04

sudo  apt install xrdp
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apturl apturl-common augeas-lenses cryptsetup cryptsetup-bin
  cryptsetup-initramfs cryptsetup-run db-util db5.3-util extlinux
  gir1.2-gudev-1.0 gir1.2-udisks-2.0 hfsplus icoutils ldmtool libafflib0v5
  libaugeas0 libconfig9 libdate-manip-perl libewf2 libhfsp0 libhivex0
  libintl-perl libintl-xs-perl libldm-1.0-0 liblockfile-bin liblockfile1
  libstring-shellquote-perl libsys-virt-perl libtsk13 libwin-hivex-perl
  libyara3 lockfile-progs lsscsi scrub sendmail-base sendmail-cf sensible-mda
  sleuthkit supermin syslinux syslinux-common syslinux-legacy zerofree
Use 'sudo apt autoremove' to remove them.
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 3 not upgraded.
Need to get 593 kB of archives.
After this operation, 3,897 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

 

After Installing Restart the xrdp

systemctl restart xrdp

 

check the status of xrdp Before connecting to it:

systemctl status xrdp
● xrdp.service - xrdp daemon
   Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-04-07 11:19:24 IST; 5s ago
     Docs: man:xrdp(8)
           man:xrdp.ini(5)
  Process: 14872 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
  Process: 14884 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 14885 (xrdp)
    Tasks: 2 (limit: 4915)
   Memory: 11.9M
   CGroup: /system.slice/xrdp.service
           ├─14885 /usr/sbin/xrdp
           └─14889 /usr/sbin/xrdp

 

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

2. Installing XRDP on Centos7

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 firewall rule to allow xrdp on port 3389 and reload it

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

Restart the service

 systemctl enable xrdp && systemctl restart xrdp

3. Connect to Windows using Remote Desktop Connection

On you windows machine goto start->search for remote connection

OR

Press windows+r -> mstsc -> enter

3. Connecting to your Rdp client from windows

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

 

 

After providing the correct credentials, you get the following page prompting for 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