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

  The script hereafter is outdated and has been replaced by a newer version.  Please Check the Download page for latest version.

 

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)

 

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….

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

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 

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….

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 

Click on Picture for Better Resolution

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

Click on picture for better resolution

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

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

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

  1. @Petre,

    This is probably due to PolKit Configuration that denying access to the partitions when connected remotely. Thist post (see https://c-nergy.be/blog/?p=12073) would give you some indication where to look and which file to modify.
    You have to find a file like /usr/share/polkit-1/actions/org.freedesktop.udisks.policy and update it accordingly….
    Give it a try and provide feedback

    Till next time
    See ya

  2. Hello Griffon

    Thank you for sharing. But. I can’t connect Ubuntu server.
    After loigin, I met a log window, follow are.

    [Connection Log]
    connecting to sesman ip 127.0.0.1 port 3350
    sesman connect ok
    sending login info to session mangager, please wait…
    login successful displat 10
    started connecting
    connection problem, giving up
    some problem

    And…. two lines had error message.

    ‘ubuntu-dock@ubuntu.com’ is now enabled.

    (process:11454): dconf-WARNING **: 15:29:03.646: failed to commit changes to dconf: The connection is closed
    ‘ubuntu-appindicators@ubuntu.com’ is now enabled.

    (process:11458): dconf-WARNING **: 15:29:03.713: failed to commit changes to dconf: The connection is closed

    Can you advise to me..?

    JackeyLee

  3. @Jackey Lee,

    After checking the installation process, we can confirm that there is a problem with the xrdp package downloaded from Ubuntu repository. The package itself is fine but there are some missing dependencies apparently. as a quick fix, uninstall the xrdp package (using sudo apt-get remove xrdp) and use the custom installation script ver 2.2 (see link https://c-nergy.be/blog/?p=12894) as this one will download all the necessary dependencies…
    we will publish soon a new post tackling this issue specifically
    Hope this help
    Till next time

  4. Yooo! This script saved me!

    I had a bad experience installing manually. Whenever I logged into the machine locally, Gnome would freeze. I could still SSH to it, access the services, et al–just a frozen GUI. So I finally managed to purge all packages installed from my `apt install`s and fix the GUI without reloading Ubuntu.

    Before removing it, I was able to connect via Remote Desktop, but I was getting the notorious login-loop and was unable to get out of it.

    I ran your script and just successfully logged into my machine–both locally AND remotely–with no issues!

  5. @Kevin,

    thank you for the positive feedback and for visiting our blog…
    We are always happy to see that some of our work can be useful and help other
    Keep going with the good work

    Till next time
    See ya

  6. This article and part 2 are awesome! I had a lot of trouble getting my VNC to work right. I had experienced the exact same GNOME related UI issues you outlined here. BTW, I was getting tigervncServer working, and the script is super useful in patching things up. In my opinion, the issues you have resolved are generically applicable for many different screen share over Ubuntu versions 18.04 to 19.10

  7. Griffon,

    The script worked like a charm, thank you for donating your time to help us rookies!

    Larry

  8. after many notworking trials i tried ti install Xrdp with your script.
    It identified Ubuntu18.04.4 LTS (I am working wioth mate)
    most of the script worked fine but I got the message:
    “./Std-Xrdp-install-0.2.sh: Zeile 110: gnome-shell-extension-tool: Befehl nicht gefunden
    ./Std-Xrdp-install-0.2.sh: Zeile 111: gnome-shell-extension-tool: Befehl nicht gefunden”
    I didn’t fin any way to “install” gnome-shee-extention-tool
    So how can I solfe this problem?
    Many thanks

  9. @Stepfl;

    First, you should check for the latest version of the script (0.2 seems a little bit out dated). You can find all version and howto guide on this page http://c-nergy.be/products.html
    Then, because you are using MATE desktop, you do not need to have the gnome-shell-extension tool installed…So technically, you can comment these lines and proceed with the installation
    Please, do not that the scripts have been developed for Standard Ubuntu Desktop version (with Gnome Desktop).. You still might need to update the script if you want to have it running properly on Ubuntu MATE

    Hope this help
    Till next time

  10. Hello!

    I tested your script em “Ubuntu 20.04.1 LTS” and it worked fine.
    Just a message on gnome-shell-extension-tool saying it’s depracated.
    Other than that it was successfull!

    Great job.

  11. @Cassio,

    Thanks for the visit and the feedback. please note that there is a newer version of the script (ver 1.2.1) that should be working against Ubuntu 20.04 and 20.10

    Till next time
    See ya

Leave a Reply