XRDP
What is xRDP?
xRDP is an open source project that allows Linux systems to support remote desktop protocol, which is used by remote desktop for Windows. This is known to be more reliable than VNC, and has GUI support unlike SSH. And, it has native Windows support unlike either of those options. To learn more, go to the official site here.
Installation
Installation varies depending on the version of Linux as we have found. We will be talking about two versions of Ubuntu in this document.
Ubuntu 14.04
This installation tends to be more cooperative as Ubuntu 14 is less restrictive when it comes to permissions for programs like this. It will be done using terminal.
Step One
To install xRDP itself (it has dependencies we will install in a bit) we must run some commands in the terminal. These commands require root priveleges. I recommend running the command sudo su when first opening the terminal and entering the appropriate password.
apt-get update
apt-get install xrdp
You could also run the commands with the sudo prefix to run them as root instead of using sudo su first
Step Two
xRDP is not compatible with Ubuntu's desktop as it is due to the code it uses. So, we will install a separate desktop to be used for remote connections via rdp.
XFCE4 is a great desktop that is compatible with xRDP, so we will use that.
To install it, run this command:
apt-get install xfce4
Must be as root
Optional recommendation from the people that made these directions originally:
One replaces the terminal with one that is considered better by some, and the other improves the icon pack.
install XFCE4 terminal (way better than xterm):
apt-get install xfce4-terminal
Install icon sets:
apt-get install gnome-icon-theme-full tango-icon-theme
ROOT IS REQUIRED
Step Three
xRDP now needs some basic configuration to work.
First we will make sure an xsession file is created by running the below command:
echo xfce4-session >~/.xsession
Then we must edit the startup file. Use whatever text editor you like, nano or vim is recommended.
Nano:
nano /etc/xrdp/startwm.sh
Vim:
vi /etc/xrdp/startwm.sh
Make sure the file looks like this:
#!/bin/sh
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG LANGUAGE
fi
startxfce4
Pay attention to the last line. Make sure to run these commands as root
Step Four
To make the changes effective immediately, the xRDP service must be restarted. To do so, use this command:
service xrdp restart
Run as root, in case you haven't noticed the pattern
Test the Connection
Using a Windows host, run remote desktop connection and connect to your Linux computer using it's IP. You're done!
Ubuntu 17.10
Ubuntu 17.10 is known for not cooperating with xRDP, but some people figured out how to make it work and wrote a script.
All hail the open source overlords
Step One
At the time of writing, the script only works with 17.10 and is version 0.1. It may not work for you, but it did on our server.
You can download the script from here the download is near the bottom of the page.
Step Two
The script is in a zip file, so first it must be extracted.
Once the script has been extracted, the script must be given proper permissions to run. This can be done by running this command:
chmod +x ~/Downloads/Std-Xrdp-Install-0.1.sh
Adjust the filepath accordingly. If the script gets updated the name will be different
Step Three
Execute the script by running this command in the same directory:
./Std-Xrdp-Install-0.1.sh
It will ask for your password if you did not open it with root privileges.
The script will tell you when it is completed.
Test Connection
Using a Windows host, use remote desktop to connect to the Linux server.
More Info for 17.10
As you may notice, 14.04 required a different desktop to be installed and 17.10 did not. The script edits the Ubuntu desktop to allow for the native desktop to work. You can use XFCE4 with 17.10 by following steps two, three, and four for the older version of Ubuntu. The only difference is the file being edited will look different in step 3, but all that needs to be done is replace what comes after fi
with startxfce4
.