Sunday 28 May 2017

Getting a remote GUI environment on Linux using XRDP

We may occasionally require the use of a remote GUI environment on a Linux server to perform some installation/upgrade/administrative tasks. This article describes the usage of one of the many tools available for this purpose i.e. xrdp.

The xrdp tool allows us to access a Linux GUI environment via Windows RDP protocol.

The article uses CentOS 7 with gnome graphical environment and for the sake of testing purposes SELinux and firewalld are turned off.


Installation:

The required packages are available in the EPEL repo so ensure that the latest EPEL repo is available.
Run the following commands to install xrdp on local centOS server.

[root@still ~]# yum install xrdp -y
[root@still ~]# yum install tiger-vnc -y

The following packages should be installed as a result:

xrdp.x86_64 1:0.9.2-10.el7
xorgxrdp.x86_64 0:0.2.1-1.el7
tigervnc.x86_64 0:1.3.1-9.el7                  
tigervnc-icons.noarch 0:1.3.1-9.el7            
tigervnc-server.x86_64 0:1.3.1-9.el7
tigervnc-server-applet.noarch 0:1.3.1-9.el7     
tigervnc-server-module.x86_64 0:1.3.1-9.el7
fltk.x86_64 0:1.3.0-13.el7                
libxshmfence.x86_64 0:1.2-1.el7                
mesa-libGLU.x86_64 0:9.0.0-4.el7


Service startup:

Use systemctl to start and service and enable it to start automatically on boot.

[root@still ~]#  systemctl start xrdp.service

Check for service status:

[root@still ~]# systemctl status xrdp.service
xrdp.service - xrdp daemon
   Loaded: loaded (/usr/lib/systemd/system/xrdp.service; disabled)
   Active: active (running) since Sun 2017-05-28 05:59:57 EDT; 9s ago
     Docs: man:xrdp(8)
           man:xrdp.ini(5)
 Main PID: 4214 (xrdp)
   CGroup: /system.slice/xrdp.service
           └─4214 /usr/sbin/xrdp --nodaemon

May 28 05:59:57 still systemd[1]: Starting xrdp daemon...
May 28 05:59:57 still systemd[1]: Started xrdp daemon.
May 28 05:59:57 still xrdp[4214]: (4214)(140444262971840)[INFO ] starting xrdp with pid 4214
May 28 05:59:57 still xrdp[4214]: (4214)(140444262971840)[INFO ] listening to port 3389 on 0.0.0.0


In addition to the xrdp service itself we need to start another service xrdp-sesman. If this service is not started then the following error will be found in xrdp log file at location /var/log/xrdp.log:

[ERROR] xrdp_wm_log_msg: Error connecting to sesman: 127.0.0.1 port: 3350

To start xrdp-sesman service type /usr/sbin/xrdp-sesman


Usage/Demo:

With the service setup on our Linux machine we can now initiate an RDP session to it from our Windows system. On the windows system search for rdp or mstsc. The following window will open:


Enter the hostname or IP address of the system you wish to connect to.
You can click on show options to expand the list available options menu and set the display and color depth as shown below:


I've observed that a lower resolution and a color depth of 16 bit seem to allow for faster optimal connectivity.
Once you've finalized your settings click on connect.
The following screen appears:


Enter the credentials you wish to use to connect with and press ok.

That is it. We are now presented with the gnome graphical environment:



I hope this article was easy to understand and informative. 

No comments:

Post a Comment

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...