Ubuntu 18.04 – Install xRDP the easy way (Scripted Installation)

Hello World, 

This is it ! The day has just arrived.  Ubuntu 18.04 LTS has just been released and it’s time to have a look at the xRDP software solution and see if any major changes have been introduced with this version of the Operating System. 

Usually, we would describe how to perform a manual installation providing step by step instruction guide.  As the process of installing xRDP and have it working didn’t change much since the Ubuntu 17.10 release, we will update the standard installation script that we have developed for Ubuntu 17.10 and make it working for Ubuntu 17.10 and Ubuntu 18.04 editions.

Note :

This post is basically an update of an existing post that was covering the version Ubuntu 17.10 (see this post).   Please use the search function or go to the xrdp section of this blog if you need xRDP installation instructions for different Ubuntu Editions. 

The Standard Installation Script – Version 0.2

Overview

The version 0.2 of the script perform a standard installation of xRDP (i.e using the xRDP package available in the Official Ubuntu Repository) and perform also the additional configuration tasks needed to have a workable xRDP solution.  The script version has been updated to version 0.2 which includes the logic to detect Ubuntu 17.10 and Ubuntu 18.04 editions and introduce some additional configuration changes…

Assumptions

Before running this script, be aware of the following assumptions

  • We have tested the script on Ubuntu 17.10 and later
  • No additional desktop interface has been installed. 
  • We have performed the test on a Virtual Machine running on Virtual box and Hyper-V Virtual machine (on Windows 2012 R2)
  • The following procedure has been performed on Ubuntu 18.04 where xorg is the default Display manager (see screenshot below)

 

U1804LTS_8

click on Picture for better resolution

Prerequisites

We assume that you have internet connection on the Ubuntu machine.  The internet connection is needed to download the necessary packages that will be installed on your system.

The script version 0.2

Important Note :

If you copy/paste the script, you might encounter some issues because font formatting might be not maintained during the copy/paste operation. Please ensure that format is  accurate before launching the script. A downloadable version of the script is available at the bottom of the post

Disclaimer : As usual, use this at your own risk !! 

################################################################
# Script_Name : Std-Xrdp-install-0.2.sh
# Description : Perform an automated standard installation of xrdp
# on ubuntu 17.10 and later
# Date : April 2018
# written by : Griffon
# Web Site :http://www.c-nergy.be - http://www.c-nergy.be/blog
# Version : 0.2
# History : 0.2 - Added Logic for Ubuntu 17.10 and 18.04 detection 
#               - Updated the polkit section
#               - New formatting and structure 
#           0.1 - Initial Script 
# Disclaimer : Script provided AS IS. Use it at your own risk....
##################################################################

echo
/bin/echo -e "\e[1;36m#-------------------------------------------------------------#\e[0m"
/bin/echo -e "\e[1;36m# Standard XRDP Installation Script - Ver 0.2 #\e[0m"
/bin/echo -e "\e[1;36m# Written by Griffon - April 2018- www.c-nergy.be #\e[0m"
/bin/echo -e "\e[1;36m#-------------------------------------------------------------#\e[0m"
echo

#---------------------------------------------------#
# Step 0 - Try to Detect Ubuntu Version.... 
#---------------------------------------------------#

echo
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
/bin/echo -e "\e[1;33m! Detecting Ubuntu version # \e[0m"
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
echo

version=$(lsb_release -d | awk -F":" '/Description/ {print $2}')

if [[ "$version" = *"Ubuntu 17.10"* ]] || [[ "$version" = *"Ubuntu 18.04"* ]];
then
echo
/bin/echo -e "\e[1;32m.... Ubuntu Version :$version\e[0m"
/bin/echo -e "\e[1;32m.... Supported version detected....proceeding\e[0m"

else
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"
/bin/echo -e "\e[1;31mYour system is not running Ubuntu 17.10 Edition.\e[0m"
/bin/echo -e "\e[1;31mThe script has been tested only on Ubuntu 17.10...\e[0m"
/bin/echo -e "\e[1;31mThe script is exiting...\e[0m"
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"
echo
exit
fi

#---------------------------------------------------#
# Step 1 - Install xRDP Software.... 
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
/bin/echo -e "\e[1;33m! Installing XRDP Packages...Proceeding... # \e[0m"
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
echo

sudo apt-get install xrdp -y

#---------------------------------------------------#
# Step 2 - Install Gnome Tweak Tool.... 
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
/bin/echo -e "\e[1;33m! Installing Gnome Tweak...Proceeding... # \e[0m"
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
echo

sudo apt-get install gnome-tweak-tool -y

#---------------------------------------------------#
# Step 3 - Allow console Access .... 
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
/bin/echo -e "\e[1;33m! Granting Console Access...Proceeding... # \e[0m"
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
echo

sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config

#---------------------------------------------------#
# Step 4 - create policies exceptions .... 
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
/bin/echo -e "\e[1;33m! Creating Polkit File...Proceeding... # \e[0m"
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
echo

sudo bash -c "cat >/etc/polkit-1/localauthority/50-local.d/45-allow.colord.pkla" <<EOF
[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF
#---------------------------------------------------#
# Step 5 - Enable Extensions .... 
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
/bin/echo -e "\e[1;33m! Install Extensions Dock...Proceeding... # \e[0m"
/bin/echo -e "\e[1;33m#---------------------------------------------#\e[0m"
echo
gnome-shell-extension-tool -e ubuntu-dock@ubuntu.com
gnome-shell-extension-tool -e ubuntu-appindicators@ubuntu.com
echo

#---------------------------------------------------#
# Step 6 - Credits .... 
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;36m#-----------------------------------------------------------------------#\e[0m"
/bin/echo -e "\e[1;36m# Installation Completed\e[0m"
/bin/echo -e "\e[1;36m# Please test your xRDP configuration....\e[0m"
/bin/echo -e "\e[1;36m# Written by Griffon - April 2018 - Ver 0.2 - Std-Xrdp-Install-0.2.sh\e[0m"
/bin/echo -e "\e[1;36m#-----------------------------------------------------------------------#\e[0m"
echo
 

How to Use the Script

 

Set Execute Right on the script

Download the Std-Xrdp-install-0.2.sh script to your system.  To have it running, the script has to be marked as executable.  To mark a script/file as executable, the following actions needs to be performed 

Right-click on the file, go to properties, then select permissions and tick the box allow executable….

U1804LTS_7

Click on picture for better resolution

 

or from the command line, issue the following command

chmod +x  ~/Downloads/Std-Xrdp-Install-0.2.sh  

Note : Adjust the path where the Std-Xrdp-Install-0.2.sh script to reflect your environment

Execute the script

To execute the script, ensure that internet connection is available (so you can download the necessary packages needed for the installation) and simply open a Terminal console.  In the Terminal console, Browse to the location where the script has been stored and then issue the following command 

 ./Std-Xrdp-Install-0.2.sh

U1804LTS_9

Click on picture for better resolution

The script will start executing and when the xrdp installation package will start, you be requested to enter your password 

U1804LTS_10

Click on picture for better resolution

Provide the password and proceed with the installation. Wait for completion of the script.  The machine will not reboot automatically when done so you can review the actions performed by the script….

U1804LTS_11

Click on picture for better resolution

Test your configuration

To Test your configuration, you need to perform the following steps 

  • step 1 – Logout from the Ubuntu machine because you can only have a single connection to the machine for the same user (either local either remote)
  • step 2 – Start your favorite remote desktop client and provide the ip address or hostname of your ubuntu machine 

Xrdp_DE_3

Click on Picture for Better Resolution

  • step 3 –  At this stage, you should see the xRDP login page. Provide your credentials

U1704_xrdp_3

Click on picture for better resolution

  • step 4 – At this stage, you should see your standard Ubuntu Gnome Desktop with the Dock visible…. 

U1804LTS_12

Click on picture for better resolution

Download the Script 

Please download the script :  Std-Xrdp-Install-0.2.zip

Final Notes

Ubuntu 18.04 LTS seems to be a good polished release and in a few weeks we will probably start deploying some computers as pilot projects.   The choice has been made to move away from Unity Desktop as it will be discontinued in the future.  

xRDP and Ubuntu 18.04 are working well together.  On my LAN network, I had the feeling that the desktop interface was quite responsive (less sluggish than previous implementation of xRDP).  I do not know if this is due to the fact that the Gnome desktop is used instead of Unity Desktop which might introduced some additional load on the remote session….  

xRDP software seems to be a good replacement solution for VNC software solution even more since Gnome Desktop is used as default Desktop.  The advantages of using xRDP are that the service starts at boot time and nobody needs to be connected to the machine to perform a remote desktop session.  Another advantage of  xrdp solution is that it creates a new display when performing the remote connection and nobody can monitor your actions if screen is connected to the remote machine which provide more security in way. 

Yes, it’s possible to have vnc server start at boot time but since Ubuntu is now using GDM3 login manager the process is really complex and the process to make the remote connection is also cumbersome (you need to perform two remote desktop connections – see this post).  We are not even sure that the process described here still works for Ubuntu 18.04…. 

xRDP has still some drawbacks.  The first one is that you cannot connect to the console (Display :0). The other limitation of xRDP is that a user can only remote connect if the user is not physically logged on into the system.   However, xRDP seems to provide a standard way of accessing remote machines and provides easy inter-operability capabilities with Windows world….

The updated version of the script should provide you automation and simplify the installation and configuration of xRDP software solution.  The manual installation is always an option but then you have to perform the configuration of your desktop when performing your first remote desktop connection….The updated version of the script streamline the installation process and configure (partially) your remote desktop session and will make the Dock and the top bar menu available by default in your remote session.  

This is it for the day.

Stay tuned  as we are preparing next posts about xRDP and possible problem resolution encountered by many people …

Keep in touch 

Till next time 

See ya

8 thoughts on “Ubuntu 18.04 – Install xRDP the easy way (Scripted Installation)

  1. When running without a graphics card or on a virtual machine I have to install xorgxrdp to make XRDP work at all.

  2. @RKantos,
    is this a question or a fact ? With xrdp package in Ubuntu 18.04, the xorgxrdp package is installed by default… So
    till next time
    see ya

  3. @Wes,
    The script has been specifically written for Ubuntu 18.04 (and no other editions). All the customization done by the script is mainly targeted to Ubuntu edition (Dock – gnome extension installation,….)
    We have no time (for the moment) to check additional flavour. However, you could try to install the xrdp package from (L)Ubuntu repository and see if this working out of the box (To install it, use sudo apt-get install xrdp and that it’s). This will install the xrdp software and you can check if this is working for you or if you need to tweak your system

    Hope this help
    Till next time
    See ya

  4. Hi.

    I tell my experiences with Ubuntu 18.04.

    I install Ubuntu virtualizado with Proxmox, with the previous versions and the information of this web, I have not had big problems to work with the different flavors of Ubuntu (Mate, Xubuntu, etc).

    With this latest version installed with the sript on this page, it works perfectly when I enter xRDP, but when I share the disk drive, the folder “home / user / thinclient_drives” is created with the disk or disks comprated from xRDP, This folder fucniona bien until I close the session and reconnect, at that time the folder is inaccessible giving an error. If I restart Ubuntu or dismount the folder with “fusermount / home / user / thinclien_drives” the next connection is correct and I will have access to the shared disk again.

    I have access to the “Share printers” connection, only the Clipboard and Units are active.

    The same result I get with Xubuntu, Lubuntu and Mate without the sript.

    I want to inform you that, in my experience, in Xubuntu, Lubuntu, Mate, etc, installing xrdp (sudo apt install xrdp) is enough to work correctly, even the keyboard, except the problem I mention sharing local resources.

    That is all.

    Thank you and sorry for the automatic translation from Spanish.

  5. @Jose Manuel,

    Thank you for the information…We will try to perform some tests and we will possibly describe this issue/behavior in a coming post…
    thank you for your sharing your findings with us and for visiting our blog

    till next time
    See ya

  6. Hi,

    Downloaded the script and run it. Everything installed properly, but when testing from windows-PC, the session is never activated.
    Only with the user logged in, I can see the splash image from xorg, but, when credentials are entered, black screen first, and then disconnected.
    With user logged out, no connection at all…

    Will try “xhost +”…

  7. @Jorge,

    No clue for the moment… Can you check your Logs and see if there is any additional hints…..
    You might need to remove/reinstall the xrdp software and try again
    Thank for the visit and the feedback
    Till next time
    See ya

Leave a Reply