Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save peter279k/59587eac765d9c3c4573634bf298db9e to your computer and use it in GitHub Desktop.
Save peter279k/59587eac765d9c3c4573634bf298db9e to your computer and use it in GitHub Desktop.
Install Remote Desktop (xRDP) for Ubuntu Server 18.04

Install Remote Desktop (xRDP) for Ubuntu Server 18.04

Step 1 – Install xRDP:

sudo apt update
sudo apt install xrdp

Step 2 – Install XFCE4

sudo apt install xfce4
sudo apt-get install xfce4-terminal tango-icon-theme

Step 3 - Configure

echo xfce4-session > ~/.xsession

Step 4 - Restart xRDP

sudo service xrdp restart

Step 5 - Testing

On Windows PC, use mstsc to connect to the ubuntu server

@peter279k
Copy link
Author

@peter279k
Copy link
Author

peter279k commented Jul 8, 2021

################################################################
# 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"* ]] || [[ "$version" = *"Ubuntu 20.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 xorg xserver-xorg-core xorgxrdp -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 adwaita-icon-theme-full -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

if [[ "$version" != *"Ubuntu 20.04"* ]];
then
    gnome-shell-extension-tool -e ubuntu-dock@ubuntu.com
    gnome-shell-extension-tool -e ubuntu-appindicators@ubuntu.com
fi;
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

@seamaner
Copy link

sudo systemctl disable --now firewalld

@peter279k
Copy link
Author

sudo systemctl disable --now firewalld

As far as I know, the firewalld is not included in the Ubuntu Linux distribution by default.

Once you've installed the firewalld, you need to disable or add the rule to let the RDP port number (3389) can pass the firewall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment