xRDP – Consolidated Script (xrdp-installer-1.0.sh – Preview Version !!!)

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

 

Hello World,

As announced in some previous posts (here and here ), we have been working on the new version of the xRDP script.  As a reminder, so far, we have been providing some scripts that can ease and simplify the installation and configuration of the xRDP software package on top of Ubuntu operating System.  The script has been created to perform some post configuration actions that should provide a better user experience and mimic the Ubuntu Desktop Look’n Feel. 

Three versions the installation script exists.   

  • The Std installation script uses the xRDP packages available in the Ubuntu repository and perform the necessary post configuration actions. 
  • The custom installation script on the other hands install xRDP package from latest xrdp binaries.  The script compiles and execute the post configuration actions needed to provide an easy to use solution.  
  • Custom installation script for Ubuntu 16.04.x version which is a little bit outdated and needs to be reviewed…

To improve a step further the installation experience and the user experience, we have decided to merge and consolidate these scripts and provide a single script that can be used to perform either installation from xrdp package availabe in Ubuntu repositories or compile from sources. We have made really good progress in the new consolidated script and it’s time to unveil it. 

The script provided here is still work in progress and need to be tested and validated. So do not consider it as final.  If you want to download and test it, you are welcome to do so and you can always notify us if you find some issues with it 

So,let’s move forward and let’s have a look on this new script 

The consolidated Script – Preview

Overview

The consolidated script aims to replace any previous versions of the xrdp installation scripts provided so far (Standard and Custom scripts).  Both scripts starts to share quite a good amount of common code.  This is the result of the previous work when we decided to re-write the script and use proper functions in the code. 

By merging these scripts, we also hope to reduce the maintenance,tests and validation activities.  Canonical releases a new Ubuntu version every 6 months + Point Releases. So, we have to tests and re-validate quite often these scripts.  By having a single script, this should help us in reducing tests and validation iterations and release scripts more quickly.

Supported Ubuntu Version 

The xrdp-installer-1.0.sh will support the following Ubuntu operating system version 

  • Ubuntu 16.04.x 
  • Ubuntu 18.04.x
  • Ubuntu 19.04

Again, the script will be based on the Ubuntu release cycle.  This means that support will be mainly provided for LTS releases. Interim releases will be included in the script and will be supported as long as they do not reach end of support.  When an interim release reach end of support, the script will be updated and will remove the retired operating system

Prerequisites and assumptions  

The following conditions should be met in order to have the best results while using the script

  • We assume that your machine is connected to internet while performing the installation.  This is needed as additional packages and software needs to be downloaded and installed on your Ubuntu machine
  • The script runs against a supported Operating system (Ubuntu 16.04.x, Ubuntu 18.04.x,Ubuntu 19.04)
  • The Official Ubuntu distribution needs to be used (we do not support other Ubuntu flavors – so far !!) 
  • No additional Desktop interface is used ( xRDP session will be showing Ubuntu Gnome Desktop with the Dock menu)
  • Sound functionality is present on the computers if you sound feature is available as well

The Script 

The consolidated script will be named xrdp-installer and version number will be set to 1.0.   The xrdp-installer-1.0.sh script code has been updated and integrates the latest features/tips/tricks founded and described through this blog.

Initially, we have first compared and merged the standard and custom script into a initial consolidated script.  This was the easy part. Then, we have increment the script with our new findings.  The script now configures your system to use environment variable while performing remote desktop connection.  The script also include the SSL Fix logic and provide an additional option to customize the xRDP login screen

The script now also support Ubuntu 16.04.  We have included this option in the script because Ubuntu 16.04 is a LTS release and still supported. This has been included in the script mainly for legacy support.  We hope that by now, you are running a more recent version of Ubuntu (i.e. Ubuntu 18.04.x). If the script detect Ubuntu 16.04 version, a custom installation is always performed.

We have also used the checkinstall command when compiling xrdp from source which provide a easy way to remove xrdp packages when compiled from source. Finally, we have improved the switch and parameters section in the script.  A bunch of new options are available now and they are a little bit easier to use. We will cover them in the following section.   

The complete script content can be found at the bottom of this post for review.  A downloadable version will be available (when ready for release) at this location.  All the previous versions of the script are also available on this page

How to Use the Script

The xrdp-installer-1.0 script will work the same way as the previous versions.  We will need to set the execute permission on the file and then you can pass zero or multiple parameters to customize your xrdp installation. We will not go into details here but simply explain how to use it and how to execute it. 

Step 1 – Set Execute Right on the script

Download the xrdp-installer-1.0.sh script to your system, extract content and mark it as executable . To do this, perform the following action in a terminal console

chmod +x  ~/Downloads/xrdp-installer-1.0.sh

Note : Adjust the path where the xrdp-Installer-1.0.sh script to reflect your environment

Step 2 – Run as normal user 

The script needs to be run as a normal user.  The script will start running and will prompt you for password when sudo actions are initiated.  If you run the script as root or using sudo command, the Download folder does not exist for the root user and the script fails to run as expected.   To overcome this situation, the script also check which user is executing the script. If the script is run under sudo or root accounts, a warning message will be displayed and the script will not execute

Step 3 – How to Use the script ?

The xrdp-installer-1.0.sh script can be executed as is (with no parameters or switches) or a user can pass some additional parameters to customize and enable additional features during the installation.   The script provides the following parameters 

--help or -h          => will display a basic help menu
--sound or -s         => will enable sound redirection 
--loginscreen or -l   => will customize the xRDP login screen 
--remove or -r        => will remove the xrdp package 
--custom or -c        => will perform a custom installation (i.e. compiled from sources)
--unofficial or -u    => will use the unofficial xRDP package for Ubuntu 18.04.2 only

The following sections will provide some examples and scenario on how you can use the script….. 

Standard Installation – No Parameters 

To perform a standard installation, you execute the script with no parameters.  Open a Terminal console, browse to the location where the script has been downloaded and issue the following command 

 ./xrdp-installer-1.0.sh

When the xrdp installation package will start, you be requested to enter your password. 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….

Important Notes

If you are running the script on Ubuntu 16.04.x, the custom installation will be performed even if you have not specified any parameters.  This is because Ubuntu 16.04.x ships with a really old xrdp package (version 0.6) and does not provides all needed features. The custom installation provide drive redirection,clipboard and access to Unity Desktop

If you running the script on Ubuntu 18.04.2, this installation mode will downgrade to older Ubuntu packages that can be used with xRDP and xorgxrdp pacakges.  This installation mode will not use the unofficial Ubuntu 18.04.2 packages (for more information, check here and here)

Standard Installation – Passing Parameters 

The script can be used to perform a standard installation and still passes some parameters to get the most of the xRDP packages and their features.  For all the Ubuntu versions, we could use the following combination of parameters 

./xrdp-installer-1.0.sh -s      (this would enable the sound redirection) 
./xrdp-installer-1.0.sh -l       (this would customize the xrdp login screen

Obviously, you can combine the switches (any order) to have more features enabled  

./xrdp-installer-1.0.sh -s -l      (this would enable the sound redirection and customize the xrdp login screen)

If you are running Ubuntu 18.04.2,  you can also decide on how to perform the installation.  You can either use the quick and dirty fix (no -u switch) or use the unofficial xrdp package (using the -u switch). For more information, check here and here

./xrdp-installer-1.0.sh -u        (this would use the unofficial package for xRDP)
./xrdp-installer-1.0.sh -u -s -l  (this would use the unofficial package for xRDP, enable sound + custom login screen)

Note : The -u option will be only effective for standard installation. If you perform a custom installation, the latest xrdp packages and xorgxrdp packages will be used and there is no need to apply any fixes…

Custom Installation 

The script can be used to perform standard installation using the xrdp package available on Ubuntu repositories or perform a custom installation.  We like the custom installation because we are then using the edge bleeding version of the xRDP packages which can introduce time to time nice improvements.  

To perform a custom installation, you will need at minimum to pass one parameter.  The following command line shows you how to perform a custom installation  

./xrdp-installer-1.0.sh -c     (this would perform a custom installation but will not enabled adv features like sound redirection or custom login screen)

If a user wants to enable additional features, you will pass some additional parameters as shown in the following examples 

./xrdp-installer-1.0.sh -c -s     (this would perform a custom install and enable sound redirection)
./xrdp-installer-1.0.sh -c -l     (this would perform a custom install and customize xrdp login screen)
./xrdp-installer-1.0.sh -c -l -s  (this would perform a custom install, enable sound and customize login screen)

Remove Installation option

This version of the script also ship with the option to remove xRDP package.  The removal option only works if you have uses this version of the script to perform the installation.  To remove the xrdp package, you would simply execute the following command  

./xrdp-installer-1.0.sh -r     (to remove the xrdp packages)

Known Issues and limitations 

If the Sound redirection option has been selected, rebooting the Ubuntu system is not enough and the sound redirection might not work.  if the sound redirection option has been selected, you will have to shutdown your Ubuntu machine and then start it again in order to ensure that the sound redirection feature would work as expected. 

Step 4 – Test your configuration 

After the script has run and after the reboot/shutdown and start process, it’s time to test and see if you can indeed perform a smooth remote connection to your Ubuntu machine.  Remember that a user can either be logged on locally or logged on remotely on the machine when working with xRDP solution.  If the user, performing the remote connection, is logged into the system locally the remote connection will start but will be terminated immediately.  This is the way it works nowadays. 

So, ensure that the user performing the test is not locally logged on, start your favourite remote desktop client and perform your connection.  Based on your options, you will be presented either with the green xrdp login screen or with the custom login screen (purple background). Simply enter your credentials and start testing your installation.  If everything is ok, you will see a similar Desktop interface where Gnome Desktop is used and the Dock is visible. 

Download the Script 

No Download available for the preview version of the script….. 

Final Notes

This is it !  The consolidated script is almost ready.  The main options are available and the logic seems correct.  Now, before declaring this script “production ready”, we will need to run it on different Ubuntu versions and uses multiple switches to ensure that the script would work as expected.   The script should be ready to go live with the release of Ubuntu 19.10 (October 2019) which offers us some additional time to refine and fixes any possible issues or bug detected before the release of Ubuntu 20.04. 

The script seems quite complete and ready to use.  If you have some time, give it a try and provide feedback.  If you find a bug or an issue with the script, let us know as well so we can try to fix it.  We are also expecting your feedback on this consolidated script. Do you think that’s a good idea…?

Till next time 

See ya

 

Appendix – The Script Code

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.

#!/bin/bash
#####################################################################################################
# Script_Name : xrdp-installer-1.0.sh (Preview)
# Description : Perform xRDP installation on Ubuntu 16.04,18.04,18.10,19.04 and perform
#               additional post configuration to improve end user experience
# Date : July 2019
# written by : Griffon
# WebSite :http://www.c-nergy.be - http://www.c-nergy.be/blog
# Version : 1.0
# History : 1.0   - Added remove option                
#         : 0.9   - updated compile section to use checkinstall
#         : 0.8   - Updated the fix_theme function to add support for Ubuntu 16.04 
#         : 0.7   - Updated prereqs function to add support for Ubuntu 16.04
#         : 0.6   - Adding logic to detect Ubuntu version for U16.04 
#         : 0.5   - Adding env variable Fix 
#         : 0.4   - Adding SSL Fix 
#         : 0.3   - Adding custom login screen option  
#         : 0.2   - Adding new code for passing parameters  
#         : 0.1   - Initial Script (merging custom & Std)       
# Disclaimer : Script provided AS IS. Use it at your own risk....
#              You can use this script and distribute it as long as credits are kept 
#              in place and unchanged   
####################################################################################################

#--------------------------------------------------------------------------#
# -----------------------Function Section - DO NOT MODIFY -----------------#
#--------------------------------------------------------------------------#

############################################################################
# DEFAULT INSTALLATION MODE : STANDARD INSTALLATION 
############################################################################

#-----------------------------------------------------#
# Function 0  - Quick and Dirty Patch Ubuntu 18.04.2  #
#-----------------------------------------------------#
install_xservercore() 
{
sudo apt-get install xserver-xorg-core -y
sudo apt-get -y install xserver-xorg-input-all 
}

#------------------------------------------------------#
# Function 1  - Unofficial xRDP Packages for  18.04.2  #
#------------------------------------------------------#
unofficial_pkg()
{
sudo add-apt-repository ppa:martinx/xrdp-hwe-18.04 -y
sudo apt-get update
}

#---------------------------------------------------#
# Function 2  - Install xRDP Software.... 
#---------------------------------------------------#
install_xrdp() 
{
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 
}

############################################################################
# ADVANCED INSTALLATION MODE : CUSTOM INSTALLATION 
############################################################################

#---------------------------------------------------#
# Function 0 - Install Prereqs...
#---------------------------------------------------#
install_prereqs() {
echo
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m   !   Installing PreReqs packages..Proceeding.  ! \e[0m"
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
echo 
sudo apt-get -y install libx11-dev libxfixes-dev libssl-dev libpam0g-dev libtool libjpeg-dev flex bison gettext autoconf libxml-parser-perl libfuse-dev xsltproc libxrandr-dev python-libxml2 nasm fuse pkg-config git intltool checkinstall
echo
/bin/echo -e "\e[1;33m   |-| Detecting xserver-xorg-core package installed  \e[0m"
xorgver=$(dpkg-query -W -f ='${Status}\n' xserver-xorg-core | awk {'print $3'}) 

if  [[ "$version" = *"Ubuntu 16.04"* ]];
then
#-- Check xserver-xorg-core package
if [[ "$xorgver" = *not-installed* ]];  
then
# - hwe 16.04 to be installed
/bin/echo -e "\e[1;32m       |-| xorg package version: xserver-xorg-core-hwe-16.04 \e[0m"
sudo apt-get install -y xserver-xorg-dev-hwe-16.04 xserver-xorg-core-hwe-16.04
fi
elif [[ "$version" = *"Ubuntu 18.04"* ]];
then
if [[ "$xorgver" = *not-installed* ]];  
then
# - hwe 18.04 to be installed
/bin/echo -e "\e[1;32m       |-| xorg package version: xserver-xorg-core-hwe-18.04 \e[0m"
echo
sudo apt-get install -y xserver-xorg-dev-hwe-18.04 xserver-xorg-core-hwe-18.04
fi
else
#-no-hwe
/bin/echo -e "\e[1;32m       |-| xorg package version: xserver-xorg-core \e[0m"
echo
sudo apt-get install -y xserver-xorg-dev xserver-xorg-core
fi
}

#---------------------------------------------------#
# Function 1 - Download XRDP Binaries... 
#---------------------------------------------------#
get_binaries() { 
echo
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m   !   Download xRDP Binaries.......Proceeding.  ! \e[0m"
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
echo

cd ~/Downloads

## -- Download the xrdp latest files
echo
/bin/echo -e "\e[1;32m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;32m   !  Preparing download xrdp package            !\e[0m"
/bin/echo -e "\e[1;32m   !---------------------------------------------!\e[0m"
echo
git clone https://github.com/neutrinolabs/xrdp.git
echo
/bin/echo -e "\e[1;32m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;32m   !  Preparing download xorgxrdp package        !\e[0m"
/bin/echo -e "\e[1;32m   !---------------------------------------------!\e[0m"
echo
git clone https://github.com/neutrinolabs/xorgxrdp.git
}

#---------------------------------------------------#
# Function 2 - compiling xrdp... 
#---------------------------------------------------#
compile_source() { 
echo
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m   !   Compile xRDP packages .......Proceeding.  ! \e[0m"
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
echo

cd ~/Downloads/xrdp

sudo ./bootstrap
sudo ./configure --enable-fuse --enable-jpeg --enable-rfxcodec
sudo make

#-- check if no error during compilation 
if [ $? -eq 0 ]
then 
/bin/echo -e "\e[1;33m   |-| Make Operation Completed successfully       \e[0m"
else 
echo
echo
/bin/echo -e "\e[1;31m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m   !   Error while Executing make                !\e[0m"
/bin/echo -e "\e[1;31m   !   The Script is exiting....                 !\e[0m"
/bin/echo -e "\e[1;31m   !---------------------------------------------!\e[0m"
exit
fi
sudo checkinstall -y

#xorgxrdp package compilation
echo
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m   !   Compile xorgxrdp packages....Proceeding.  ! \e[0m"
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
echo

cd ~/Downloads/xorgxrdp 

sudo ./bootstrap 
sudo ./configure 
sudo make

# check if no error during compilation 
if [ $? -eq 0 ]
then 
echo
/bin/echo -e "\e[1;33m   |-| Make Operation Completed successfully       \e[0m"
echo
else 
echo
/bin/echo -e "\e[1;31m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m   !   Error while Executing make                !\e[0m"
/bin/echo -e "\e[1;31m   !   The Script is exiting....                 !\e[0m"
/bin/echo -e "\e[1;31m   !---------------------------------------------!\e[0m"
exit
fi
sudo checkinstall -y

}

#---------------------------------------------------#
# Function 3 - create services .... 
#---------------------------------------------------# 
enable_service() {
echo
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m   !   Creating xRDP services.......Proceeding.  ! \e[0m"
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
echo
sudo systemctl daemon-reload
sudo systemctl enable xrdp.service
sudo systemctl enable xrdp-sesman.service
sudo systemctl start xrdp

}

############################################################################
# COMMON FUNCTIONS - WHATEVER INSTALLATION MODE 
############################################################################

#---------------------------------------------------#
# Function 0 - Install Gnome Tweak Tool.... 
#---------------------------------------------------#
install_tweak() 
{
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
}

#--------------------------------------------------------------------#
# Fucntion 1 - Allow console Access ....
#--------------------------------------------------------------------#
allow_console() 
{
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
}

#---------------------------------------------------#
# Function 2 - create policies exceptions .... 
#---------------------------------------------------#
create_polkit()
{
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

[Allow Package Management all Users]
Identity=unix-user:*
Action=org.debian.apt.*;io.snapcraft.*;org.freedesktop.packagekit.*;com.ubuntu.update-notifier.*
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF

}

#---------------------------------------------------#
# Function 3 - Fixing Theme and Extensions .... 
#---------------------------------------------------#
fix_theme()
{
echo
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m   !   Fix Theme and extensions...Proceeding...  !\e[0m"
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"

# Checking if script has run already 
if [ -f /etc/xrdp/startwm.sh.griffon ]
then
sudo rm /etc/xrdp/startwm.sh
sudo mv /etc/xrdp/startwm.sh.griffon /etc/xrdp/startwm.sh
fi 

#Backup the file before modifying it
sudo cp /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.griffon

if  [[ "$version" = *"Ubuntu 16.04"* ]];
then
echo
sudo sed -i "/# auth /a cat >~/.xsession << EOF\n#Unity Xrdp multi-users \n/usr/lib/gnome-session/gnome-session-binary --session=ubuntu &\n/usr/lib/x86_64-linux-gnu/unity/unity-panel-service &\n/usr/lib/unity-settings-daemon/unity-settings-daemon &\nfor indicator in /usr/lib/x86_64-linux-gnu/indicator-*;\ndo\nbasename='basename \\\\\${indicator}'\ndirname='dirname \\\\\${indicator}'\nservice=\\\\\${dirname}/\\\\\${basename}/\\\\\${basename}-service\n\\\\\${service} &\ndone\nunity\nEOF" /etc/xrdp/startwm.sh
echo
else 
echo
sudo sed -i "4 a #Improved Look n Feel Method\ncat <<EOF > ~/.xsessionrc\nexport GNOME_SHELL_SESSION_MODE=ubuntu\nexport XDG_CURRENT_DESKTOP=ubuntu:GNOME\nexport XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg\nEOF\n" /etc/xrdp/startwm.sh
echo
fi
}

#---------------------------------------------------#
# Function 4 - Enable Sound Redirection .... 
#---------------------------------------------------#
enable_sound()
{
echo
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m   !   Enabling Sound Redirection...             !\e[0m"
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m"
echo

# Step 1 - Enable Source Code Repository
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename' main restricted'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename' restricted universe main multiverse'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename'-updates restricted universe main multiverse'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename'-backports main restricted universe multiverse'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename'-security main restricted universe main multiverse'
sudo apt-get update

# Step 2 - Install Some PreReqs
sudo apt-get install git libpulse-dev autoconf m4 intltool build-essential dpkg-dev -y
sudo apt build-dep pulseaudio -y

# Step 3 -  Download pulseaudio source in /tmp directory - Do not forget to enable source repositories
cd /tmp
sudo apt source pulseaudio

# Step 4 - Compile
pulsever=$(pulseaudio --version | awk '{print $2}')
cd /tmp/pulseaudio-$pulsever
sudo ./configure

# step 5 - Create xrdp sound modules
sudo git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
cd pulseaudio-module-xrdp
sudo ./bootstrap 
sudo ./configure PULSE_DIR="/tmp/pulseaudio-$pulsever"
sudo make

#Step 6 copy files to correct location (as defined in /etc/xrdp/pulse/default.pa)
cd /tmp/pulseaudio-$pulsever/pulseaudio-module-xrdp/src/.libs
sudo install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so
sudo install -t "/usr/lib/pulse-$pulsever/modules" -D -m 644 *.so
echo

}

#---------------------------------------------------#
# Function 5 - Custom xRDP Login Screen .... 
#---------------------------------------------------#
custom_login()
{
echo 
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m" 
/bin/echo -e "\e[1;33m ! Customizing xRDP login screen               !\e[0m" 
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m" 
echo 

cd ~/Downloads
wget http://www.c-nergy.be/downloads/griffon_logo_xrdp.bmp

#Check if script has run once...
if [ -f /etc/xrdp/xrdp.ini.griffon ]
then
sudo rm /etc/xrdp/xrdp.ini
sudo mv /etc/xrdp/xrdp.ini.griffon /etc/xrdp/xrdp.ini
fi 

#Backup file 
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.griffon

if  [[ "$adv" = "yes" ]];
then
sudo cp griffon_logo_xrdp.bmp /usr/local/share/xrdp
sudo sed -i 's/ls_logo_filename=/ls_logo_filename=\/usr\/local\/share\/xrdp\/griffon_logo_xrdp.bmp/g' /etc/xrdp/xrdp.ini
else
sudo cp griffon_logo_xrdp.bmp /usr/share/xrdp/
sudo sed -i 's/ls_logo_filename=/ls_logo_filename=\/usr\/share\/xrdp\/griffon_logo_xrdp.bmp/g' /etc/xrdp/xrdp.ini
fi

sudo sed -i 's/blue=009cb5/blue=dedede/' /etc/xrdp/xrdp.ini
sudo sed -i 's/#white=ffffff/white=dedede/' /etc/xrdp/xrdp.ini
sudo sed -i 's/#ls_title=My Login Title/ls_title=Remote Desktop for Linux/' /etc/xrdp/xrdp.ini
sudo sed -i 's/ls_top_window_bg_color=009cb5/ls_top_window_bg_color=2c001e/' /etc/xrdp/xrdp.ini
sudo sed -i 's/ls_bg_color=dedede/ls_bg_color=ffffff/' /etc/xrdp/xrdp.ini
sudo sed -i 's/ls_logo_x_pos=55/ls_logo_x_pos=0/' /etc/xrdp/xrdp.ini
sudo sed -i 's/ls_logo_y_pos=50/ls_logo_y_pos=5/' /etc/xrdp/xrdp.ini
}

#---------------------------------------------------#
# Function 6 - Fix SSL Minor Issue .... 
#---------------------------------------------------#
fix_ssl() 
{ 
echo 
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m" 
/bin/echo -e "\e[1;33m   ! Fixing SSL Cert Issue ...                   !\e[0m" 
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m" 
echo 
sudo adduser xrdp ssl-cert 
}

#---------------------------------------------------#
# Function 7 - Fixing env variables in XRDP .... 
#---------------------------------------------------#
fix_env()
{
#Add this line to /etc/pam.d/xrdp-sesman if not present
if grep -Fxq "session required pam_env.so readenv=1 user_readenv=0" /etc/pam.d/xrdp-sesman 
   then
            echo "Env settings already set"
   else
		sudo sed -i '1 a session required pam_env.so readenv=1 user_readenv=0' /etc/pam.d/xrdp-sesman
 fi
}

#---------------------------------------------------#
# Function 8 - Removing XRDP Packages .... 
#---------------------------------------------------#
remove_xrdp()
{
echo 
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m" 
/bin/echo -e "\e[1;33m   ! Removing xRDP Packages...                   !\e[0m" 
/bin/echo -e "\e[1;33m   !---------------------------------------------!\e[0m" 
echo 
sudo systemctl stop xrdp
sudo apt-get autoremove xrdp 
sudo systemctl disable xrdp
}

#---------------------------------------------------#
# SECTION FOR OPTIMIZING CODE USAGE...              #
#---------------------------------------------------#
install_common()
{
allow_console
create_polkit
fix_theme
fix_ssl
fix_env
}

install_custom()
{
install_prereqs
get_binaries
compile_source
enable_service
}

check_upackage()
{
if  [[ "$version" = *"Ubuntu 18.04.2"* ]];
then
/bin/echo -e "\e[1;32m       |-| Ubuntu Version : $version\e[0m"
echo
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m   !  Applying Installation Patch for Ubuntu 18.04.2 Only        !\e[0m"
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
echo
if [ "$fixpkg" = "yes" ];
then
/bin/echo -e "\e[1;32m   	=>  Downloading Unofficial xRDP packages (Thiago Martins)      !\e[0m"
echo
unofficial_pkg
else
/bin/echo -e "\e[1;32m   	=>  Downgrading to previous xserver-xorg-* packages            !\e[0m"
echo
install_xservercore
fi
fi #End Check Version 18.04
}

sh_credits()
{
echo
/bin/echo -e "\e[1;36m   !----------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m   ! Installation Completed...Please test your xRDP configuration   !\e[0m" 
/bin/echo -e "\e[1;36m   ! If Sound option selected, shutdown your machine completely     !\e[0m"
/bin/echo -e "\e[1;36m   ! start it again to have sound working as expected               !\e[0m"
/bin/echo -e "\e[1;36m   !                                                                !\e[0m"
/bin/echo -e "\e[1;36m   ! Special Thanks - Thiago for Unoffical xrdp packages            !\e[0m"
/bin/echo -e "\e[1;36m   !                  patching Ubuntu 18.04.2 issue                 !\e[0m"                                                                          
/bin/echo -e "\e[1;36m   !                                                                !\e[0m"
/bin/echo -e "\e[1;36m   ! Credits : Written by Griffon - July 2019                       !\e[0m"
/bin/echo -e "\e[1;36m   !           www.c-nergy.be -xrdp-installer-v1.0.sh - ver 1.0     !\e[0m"
/bin/echo -e "\e[1;36m   !----------------------------------------------------------------!\e[0m"
echo
}

#--------------------------------------------------------------------------#
# -----------------------END Function Section             -----------------#
#--------------------------------------------------------------------------#

#--------------------------------------------------------------------------#
#------------                 MAIN SCRIPT SECTION       -------------------#  
#--------------------------------------------------------------------------#

#---------------------------------------------------#
# Script Version information Displayed              #
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m   !   xrdp-installer script - Ver 1.0                           !\e[0m"
/bin/echo -e "\e[1;36m   !   xrdp installer for U16.04/18.04/18.10/19.04               !\e[0m"
/bin/echo -e "\e[1;36m   !   Written by Griffon - July 2019 - www.c-nergy.be           !\e[0m"
/bin/echo -e "\e[1;36m   !                                                             !\e[0m"
/bin/echo -e "\e[1;36m   !   For Help and Syntax, type ./xrdp-installer-1.0.sh -h      !\e[0m"
/bin/echo -e "\e[1;36m   !                                                             !\e[0m"
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
echo
#----------------------------------------------------------#
# Step 0 -Detecting if Parameters passed to script ....    #
#----------------------------------------------------------#
for arg in "$@"
do
    #Help Menu Requested 
    if [ "$arg" == "--help" ] || [ "$arg" == "-h" ]
    then
	echo "Usage Syntax and Examples"
	echo
	echo " --custom or -c		custom xRDP install (compilation from sources)"
    echo " --loginscreen or -l	used to customize xRDP login screen"
	echo " --remove or -r		removing xRDP packages"
	echo " --sound or -s		enable sound redirection in xRDP"
	echo " --unofficial or -u	use unofficial xRDP packages - patch for U18.04.2"
	echo
	echo "example : ./xrdp-installer-1.0.sh -c -s        custom install with sound redirection"
	echo "        : ./xrdp-installer-1.0.sh -l           standard install with custom login screen"
	echo "        : ./xrdp-installer-1.0.sh              standard install no additional features"
	
	echo
	exit
    fi
    # Sound redirection option 
    if [ "$arg" == "--sound" ] || [ "$arg" == "-s" ]
    then
        echo " |- sound Installation Option Selected ."
	fixSound="yes"  
    fi
    # Unofficial xRDP packages for U18.04.2 
	if [ "$arg" == "--unofficial" ] || [ "$arg" == "-u" ]
    then
        echo  " |- Unofficial Installation Option Selected ."
	fixpkg="yes" 
    fi
	# customize xRDP Login screen 
	if [ "$arg" == "--loginscreen" ] || [ "$arg" == "-l" ]
    then
        echo " |- Customization option for xRDP loging screen selected ."
	fixlogin="yes"
    fi
	 # Sound redirection option 
    if [ "$arg" == "--custom" ] || [ "$arg" == "-c" ]
    then
        echo " |- Custom Installation Option Selected ."
	adv="yes"  
    fi
	 # Sound redirection option 
    if [ "$arg" == "--remove" ] || [ "$arg" == "-r" ]
    then
        echo " |- Removal Option Selected ."
	removal="yes"  
    fi
	
done 
#--------------------------------------------------------------------------------#
#-- Step 0 - Check that the script is run as normal user and not as root.... 
#-------------------------------------------------------------------------------#
if [[ $EUID -ne 0 ]]; then
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m   !  Standard user detected....Proceeding....                   !\e[0m"
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
else
echo
/bin/echo -e "\e[1;31m   !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m   !  Script is run with admin priveleges. The script should be  !\e[0m"
/bin/echo -e "\e[1;31m   !  run under a standard user account. sudo privileges will be !\e[0m"
/bin/echo -e "\e[1;31m   !  prompted during execution                                  !\e[0m"
/bin/echo -e "\e[1;31m   !-------------------------------------------------------------!\e[0m"
echo
sh_credits
exit 
fi
#---------------------------------------------------#
#-- Step 1 - Try to Detect Ubuntu Version.... 
#---------------------------------------------------#
version=$(lsb_release -sd) 
codename=$(lsb_release -sc)
echo
/bin/echo -e "\e[1;33m   |-| Detecting Ubuntu version        \e[0m"
if  [[ "$version" = *"Ubuntu 16.04"* ]];
then
/bin/echo -e "\e[1;32m       |-| Ubuntu Version : $version\e[0m"
echo
elif  [[ "$version" = *"Ubuntu 18.04"* ]];
then
/bin/echo -e "\e[1;32m       |-| Ubuntu Version : $version\e[0m"
echo
elif [[ "$version" = *"Ubuntu 18.10"* ]];
then
/bin/echo -e "\e[1;32m       |-| Ubuntu Version : $version\e[0m"
echo
elif [[ "$version" = *"Ubuntu 19.04"* ]];
then
/bin/echo -e "\e[1;32m       |-| Ubuntu Version : $version\e[0m"
echo
else
/bin/echo -e "\e[1;31m  !--------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m  ! Your system is not running a supported version               !\e[0m"
/bin/echo -e "\e[1;31m  ! The script has been tested only on the following versions    !\e[0m"
/bin/echo -e "\e[1;31m  ! U16.04.x/18.04.x/18.10.x/19.04.x                             !\e[0m"
/bin/echo -e "\e[1;31m  ! The script is exiting...                                     !\e[0m"              
/bin/echo -e "\e[1;31m  !--------------------------------------------------------------!\e[0m"
echo
exit
fi

#--------------------------------------------------------------------------------#
#-- Step 2 - Check if Removal Option Selected 
#--------------------------------------------------------------------------------#
if [ "$removal" = "yes" ]; 
then 
remove_xrdp
echo
sh_credits
exit
fi
#---------------------------------------------------------#
# Step 3 - Executing the installation & config tasks .... #
#---------------------------------------------------------#

#-------------------------------------------------------------------
#- If Ubuntu 16.04 detected, we always perform a custom installation 
#-------------------------------------------------------------------
if  [[ "$version" = *"Ubuntu 16.04"* ]];
then
echo
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m   !  Custom Installation for Ubuntu 16.04.x                     !\e[0m"
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
echo
install_custom
install_common
fi
#---------------------------------------------------------------------------------------
#- If custom option detected, additional check for U16.04 so skipped
#----------------------------------------------------------------------------------------
if  [[ "$version" != *"Ubuntu 16.04"* ]];
then

if [ "$adv" = "yes" ]; 
then
echo
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m   !  Custom Installation Option Selected.....                   !\e[0m"
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
echo
echo "custom selected and perform install"
install_custom
install_tweak
install_common
else
echo
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m   !  Standard Installation Mode Selected - U18.04 and later     !\e[0m"
/bin/echo -e "\e[1;36m   !-------------------------------------------------------------!\e[0m"
echo
# Std Installation mode detectedected.....
# check if Ubuntu 18.04.2 running and apply selected fix 
check_upackage
#Perform then the installation of xRDP.....
install_xrdp
install_tweak
install_common
fi  #end if Adv option 
fi  # end if version check not like U16.04

### ADDITIONAL OPTIONS 
if [ "$fixSound" = "yes" ]; 
then 
enable_sound
fi

if [ "$fixlogin" = "yes" ]; 
then 
echo
custom_login
fi
### show Credits  
sh_credits

9 thoughts on “xRDP – Consolidated Script (xrdp-installer-1.0.sh – Preview Version !!!)

  1. Hi Griffon – really excited about this script and thanks for your efforts!
    Using an Ubuntu 16.0.4.5 LTS machine, which had xrdp 0.6.1, running with MATE per your older guide. The machine has ubuntu desktop installed as well.

    Ran this new script, which ran fine, remote desktop connection came up, but after credentials, I only get a black screen and immediate logout (with the Xorg option). The Xvnc option simply says “some error occurred”, and the credential window does not pop up.

    Thoughts? Thanks…

  2. Thanks for providing this script!

    I tried it on a fresh installation of Ubuntu 18.04.3 and besides two minor issues everything works fine:

    The first problem that it seems as if Ubuntu 18.04.3 is also affected by the dependency problems in xrdp linke in Ubuntu 18.04.2. So if you just let the script run on default mode the hotfix in the function install_xservercore() is not executed.
    If you however modify the switch, so that it is also triggered for Ubuntu 18.04.3, then everything works fine.

    Another minor issue is the Dock visibility. The script installs the gnome-tewak-tools but does not enable the two extensions needed for the correct dock display automatically. I think it would be nice to integrate this into the script (if possible) so that you don’t have to enable these extensions manually.

    Anyway, thanks for the great work!

  3. @XRDP Fan,

    First, thank you for taking time to test the script and provide some feedback on it…

    if you have used the script on Ubuntu 16.04.X, only the xorg option should be used (no Xvnc anymore). The fact that you are disconnected almost immediately would let me think that the user account used to perform the remote connection is also logged on the Ubuntu machine locally. with xrdp version 0.9.X, you cannot have the same user connected locally and remotely.. Possibly, needs to check the logs if this is not fixing your issues…. Check the /var/log/xrdp.log and /var/log/xrdp-sesman.log…

    waiting for any feedback…..
    Hope this help
    Till next time
    See ya

  4. @Lukas,

    Thank you for testing the script and providing feedback…..
    I will need to check the install_xservercore() function in order to be sure that this would be executed as expected…
    The Dock issue is kind of strange…. Normally, as we are using the rc script, it should configure the remote desktop session with the same desktop as the one used locally… The previous versions of the script were executing commands to enable the extensions but this should not be needed anymore…. anyway, we will check these issues and try to integrate this in the final version

    Thank for you time and comments
    Till next time
    See ya

  5. Thanks, Griffon. I will re-test and get back. I had uninstalled and reverted to the old 0.6.1+MATE, so I will re-install.

    One question about being logged in locally + remotely. By locally, do you mean physically on the device? I had ssh sessions open, but I was not physically logged in on the device.

    Thanks again!

  6. @Griffon,

    Hi Griffon, I reinstalled, rebooted to make sure nobody is logged in locally or otherwise. Unfortunately, the same symptoms persist – black screen then shutdown. I am including the logs below (with private information obfuscated) in case they would help.
    One other thing is that this machine has the nvidia driver version 418.87. I don’t know if this is relevant, but someone on another blog seemed to have some problems when nvidia drivers were installed.

    Thanks again!

    From /var/log/xrdp.log :
    [20190913-17:25:35] [INFO ] Socket 12: AF_INET connection received from **** port 53777
    [20190913-17:25:35] [DEBUG] Closed socket 12 (AF_INET ****:3389)
    [20190913-17:25:35] [DEBUG] Closed socket 11 (AF_INET 0.0.0.0:3389)
    [20190913-17:25:35] [INFO ] Using default X.509 certificate: /etc/xrdp/cert.pem
    [20190913-17:25:35] [INFO ] Using default X.509 key file: /etc/xrdp/key.pem
    [20190913-17:25:36] [WARN ] TLSv1.3 enabled by config, but not supported by system OpenSSL
    [20190913-17:25:36] [DEBUG] TLSv1.2 enabled
    [20190913-17:25:36] [DEBUG] Security layer: requested 11, selected 1
    [20190913-17:25:36] [DEBUG] Closed socket 12 (AF_INET ****:3389)
    [20190913-17:25:36] [INFO ] Socket 12: AF_INET connection received from **** port 53778
    [20190913-17:25:36] [DEBUG] Closed socket 12 (AF_INET ****:3389)
    [20190913-17:25:36] [DEBUG] Closed socket 11 (AF_INET 0.0.0.0:3389)
    [20190913-17:25:36] [INFO ] Using default X.509 certificate: /etc/xrdp/cert.pem
    [20190913-17:25:36] [INFO ] Using default X.509 key file: /etc/xrdp/key.pem
    [20190913-17:25:36] [WARN ] TLSv1.3 enabled by config, but not supported by system OpenSSL
    [20190913-17:25:36] [DEBUG] TLSv1.2 enabled
    [20190913-17:25:36] [DEBUG] Security layer: requested 11, selected 1
    [20190913-17:25:36] [INFO ] connected client computer name: ****
    [20190913-17:25:36] [INFO ] adding channel item name rdpdr chan_id 1004 flags 0x80800000
    [20190913-17:25:36] [INFO ] adding channel item name rdpsnd chan_id 1005 flags 0xc0000000
    [20190913-17:25:36] [INFO ] adding channel item name cliprdr chan_id 1006 flags 0xc0a00000
    [20190913-17:25:36] [INFO ] adding channel item name drdynvc chan_id 1007 flags 0xc0800000
    [20190913-17:25:37] [INFO ] TLS connection established from * port 53778: TLSv1.2 with cipher ****
    [20190913-17:25:37] [DEBUG] xrdp_0000129a_wm_login_mode_event_00000001
    [20190913-17:25:37] [INFO ] Loading keymap file /etc/xrdp/km-00000409.ini
    [20190913-17:25:37] [WARN ] local keymap file for 0x00000409 found and doesn’t match built in keymap, using local keymap file
    [20190913-17:25:47] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
    [20190913-17:25:47] [INFO ] xrdp_wm_log_msg: sesman connect ok
    [20190913-17:25:47] [DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait…
    [20190913-17:25:47] [DEBUG] return value from xrdp_mm_connect 0
    [20190913-17:25:48] [INFO ] xrdp_wm_log_msg: login successful for display 11
    [20190913-17:25:48] [DEBUG] xrdp_wm_log_msg: started connecting
    [20190913-17:25:48] [INFO ] lib_mod_log_peer: xrdp_pid=4762 connected to X11rdp_pid=4768 X11rdp_uid=1000 X11rdp_gid=1000 client_ip=**** client_port=53778
    [20190913-17:25:48] [DEBUG] xrdp_wm_log_msg: connected ok
    [20190913-17:25:48] [DEBUG] xrdp_mm_connect_chansrv: chansrv connect successful
    [20190913-17:25:49] [DEBUG] Closed socket 18 (AF_INET 127.0.0.1:55220)
    [20190913-17:25:49] [DEBUG] Closed socket 12 (AF_INET ****:3389)
    [20190913-17:25:49] [DEBUG] xrdp_mm_module_cleanup
    [20190913-17:25:49] [DEBUG] Closed socket 19 (AF_UNIX)
    [20190913-17:25:49] [DEBUG] Closed socket 20 (AF_UNIX)

    From /var/log/xrdp-sesman.log:
    [20190913-17:25:47] [INFO ] A connection received from 127.0.0.1 port 55220
    [20190913-17:25:47] [INFO ] ++ created session (access granted): username ****, ip ****:53778 – socket: 12
    [20190913-17:25:47] [INFO ] starting Xorg session…
    [20190913-17:25:47] [DEBUG] Closed socket 9 (AF_INET 0.0.0.0:5910)
    [20190913-17:25:48] [DEBUG] Closed socket 9 (AF_INET 0.0.0.0:0)
    [20190913-17:25:48] [DEBUG] Closed socket 9 (AF_INET 0.0.0.0:5911)
    [20190913-17:25:48] [DEBUG] Closed socket 9 (AF_INET 0.0.0.0:6011)
    [20190913-17:25:48] [DEBUG] Closed socket 9 (AF_INET 0.0.0.0:6211)
    [20190913-17:25:48] [DEBUG] Closed socket 8 (AF_INET 127.0.0.1:3350)
    [20190913-17:25:48] [INFO ] calling auth_start_session from pid 4763
    [20190913-17:25:48] [DEBUG] Closed socket 7 (AF_INET 127.0.0.1:3350)
    [20190913-17:25:48] [DEBUG] Closed socket 8 (AF_INET 127.0.0.1:3350)
    [20190913-17:25:48] [INFO ] Xorg :11 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log
    [20190913-17:25:48] [CORE ] waiting for window manager (pid 4767) to exit
    [20190913-17:25:49] [CORE ] window manager (pid 4767) did exit, cleaning up session
    [20190913-17:25:49] [INFO ] calling auth_stop_session and auth_end from pid 4763
    [20190913-17:25:49] [DEBUG] cleanup_sockets:
    [20190913-17:25:49] [DEBUG] cleanup_sockets: deleting /tmp/.xrdp/xrdp_chansrv_audio_out_socket_11
    [20190913-17:25:49] [DEBUG] cleanup_sockets: deleting /tmp/.xrdp/xrdp_chansrv_audio_in_socket_11
    [20190913-17:25:49] [DEBUG] cleanup_sockets: deleting /tmp/.xrdp/xrdpapi_11
    [20190913-17:25:49] [INFO ] ++ terminated session: username ****, display :11.0, session_pid 4763, ip ****:53778 – socket: 12

  7. @Griffon,

    As a further update, I got this working by changing the bottom lines in startwm.sh to put “mate-session” into .xsession rather than the default unity when xrdp is invoked (inspired by another blog posting I found).
    The clipboard feature works great! Thanks again for helping the community with this script…

  8. @XRDP FAN,

    Thank you very much for the feedback… all the info you have provided will be really helpful to improve the script….

    Indeed, you can use a different desktop env. like mate-desktop. We will have to check if indeed combination of Unity and Nvidia could be the problem

    Keep in touch and again, thank you… great feedback

    Till next time
    See ya

  9. @ Griffon,

    Thanks for the comment about the dock issue. With this information, I was able to narrow down the problem:

    So if I rebot the machine and log in via remote then the dock is displayed correctly.

    If I close (click x) the remote desktop client on windows and login via remote again then the dock is again displayed correctly.

    However if I close the remote desktop connection by clicking on the log-out button in ubuntu and then reconnect, the dock is not displayed correctly anymore.

    My currecnt file /etc/startwm.sh looks like this:

    #!/bin/sh
    # xrdp X session start script (c) 2015, 2017 mirabilos
    # published under The MirOS Licence

    #Improved Look n Feel Method
    cat < ~/.xsessionrc
    export GNOME_SHELL_SESSION_MODE=ubuntu
    export XDG_CURRENT_DESKTOP=ubuntu:GNOME
    export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
    EOF

    if test -r /etc/profile; then
    . /etc/profile
    fi

    if test -r /etc/default/locale; then
    . /etc/default/locale
    test -z “${LANG+x}” || export LANG
    test -z “${LANGUAGE+x}” || export LANGUAGE
    test -z “${LC_ADDRESS+x}” || export LC_ADDRESS
    test -z “${LC_ALL+x}” || export LC_ALL
    test -z “${LC_COLLATE+x}” || export LC_COLLATE
    test -z “${LC_CTYPE+x}” || export LC_CTYPE
    test -z “${LC_IDENTIFICATION+x}” || export LC_IDENTIFICATION
    test -z “${LC_MEASUREMENT+x}” || export LC_MEASUREMENT
    test -z “${LC_MESSAGES+x}” || export LC_MESSAGES
    test -z “${LC_MONETARY+x}” || export LC_MONETARY
    test -z “${LC_NAME+x}” || export LC_NAME
    test -z “${LC_NUMERIC+x}” || export LC_NUMERIC
    test -z “${LC_PAPER+x}” || export LC_PAPER
    test -z “${LC_TELEPHONE+x}” || export LC_TELEPHONE
    test -z “${LC_TIME+x}” || export LC_TIME
    test -z “${LOCPATH+x}” || export LOCPATH
    fi

    if test -r /etc/profile; then
    . /etc/profile
    fi

    test -x /etc/X11/Xsession && exec /etc/X11/Xsession
    exec /bin/sh /etc/X11/Xsession

    and in Tweaks all sliders in extensions are turned off.

    So i can least work around the issue by not loggin out in Ubuntu, but if you can reproduce this problem I think it would be nice to also be able to log out in Ubuntu and not use the dock.

    However, if something is not configured correctly, I am happy for some instructions.

    Regards
    Lukas

Leave a Reply