Enable Remote Desktop on Linux RHEL6/CentOS6
Our requirement is to enable remote desktop function in CentOS Linux machine which will allow us to access Linux box from windows machine using mstsc.exe (Remote Desktop).
What is XRDP?
XRDP is very handy package available on EPL repository, it supports Microsoft Remote Desktop Protocol. In order to access Linux machine from windows RDP client we will install and setup XRDP on linux.
We need some additional work to install XRDP on CentOS, as CentOS repositories does not contain the XRDP package. You need to download and add EPEL (Extra Packages Enterprise Linux).
Let’s verify our correct OS architecture first.
Using below command we can verify OS architecture.
# uname -r
If the output shows x86_64 at end then mean, you have a 64-bit install or if it shows i386 then your OS architecture is 32-bit.
Our output is showing (2.6.32-279.el6.i686) it’s mean we have 32-bit operating system.
After determining your architecture, install the correct EPEL repository with below command.
For RedHat or Centos 6.x 32-bit
# rpm -ivh epel-release-6-8.noarch.rpm
For RedHat or Centos 6.x 64-bit
#rpm -ivh epel-release-6-8.noarch.rpm
Lets verify EPEL repository is installed correctly
yum repolist -v | grep epel
We can see EPEL repository is installed correctly.
Now we are ready to install XRDP package. It will install also some dependencies.
yum install xrdp tigervnc-server
After instllation we need to configure display.
Edit display file located at /etc/sysconfig/vncservers
Find at last these lines
# VNCSERVERARGS=”-geometry 800×600 -nolisten tcp -localhost”
Uncomment and change them into.
I am using root user as my remote desktop user.
Now save this file and exit.
Start VNC and XRDP services.
service vncserver start
service xrdp start
Make them available on next startup.
chkconfig xrdp on
chkconfig vncserver on
Thatâ€™s it all the packages are installed, now you should be able to access your linux box from any RDP Client.
Before we connect to our Linux box, make sure you allowed 3389 port in iptables rules see below.
iptables -I INPUT -p tcp --dport 3389 -j ACCEPT
service iptables save
service iptables restart
Now we will access linux box from windows 7 machines .you can access your linux box from any rdp client such as mstsc from windows xp, windows 7 and windows 8.
Open run box type mstsc and hit enter.
You will see small rdp box will appear that will ask ip address or hostname of the target machine.
I will enter my linux box ip address.
Before we connect I will adjust my display size by clicking on options and then display. See blow.
After modify display setting now click on connect.
Enter Linux machine credential for authentication, i am using root user.
Finally we are able to access Linux box using Remote Desktop from Windows PC.