How to Install xrdp on CentOS 7
xrdp is a free and open-source implementation of a remote desktop protocol server that enables Linux operating systems to provide a fully functional RDP compatible remote desktop experience. It allows us to take remote desktop connection of the Linux server from the Microsoft Windows machine.
Install and Configure EPEL Repository
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Install xrdp
sudo yum install xrdp tigervnc-server
Once xrdp package and respective dependencies installed. Start the xrdp service.
sudo systemctl start xrdp
Run the below command to enable the service at system startup.
sudo systemctl enable xrdp
Firewall
By default xrdp use port 3389, so we need to configure the firewall to allow RDP connection for external machines to connect.
sudo firewall-cmd --add-port=3389/tcp --permanent
sudo firewall-cmd --reload
SELinux
Configure SELinux
sudo chcon --type=bin_t /usr/sbin/xrdp
sudo chcon --type=bin_t /usr/sbin/xrdp-sesman
or change SELinux mode to permissive
sudo vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
setenforce 0