Skip to content

Instantly share code, notes, and snippets.

@djravine
Last active January 19, 2023 03:21
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djravine/88f2b9957a0bef6a6dd4c55aca951a09 to your computer and use it in GitHub Desktop.
Save djravine/88f2b9957a0bef6a6dd4c55aca951a09 to your computer and use it in GitHub Desktop.
Setup Local xRDP on Ubuntu 18.04
#!/bin/bash
set -xuo pipefail
# GIST: https://gist.github.com/djravine/88f2b9957a0bef6a6dd4c55aca951a09
# USAGE: curl -sL https://gist.github.com/djravine/88f2b9957a0bef6a6dd4c55aca951a09/raw | bash -s --
# INSTALL SOFTWARE
sudo apt-get update
sudo apt-get install -y \
ubuntu-desktop \
xorg \
xrdp \
xorgxrdp \
xorg-video-abi-23 \
xserver-xorg-core \
xserver-xorg-input-all \
xfonts-base \
xfonts-75dpi \
xfonts-100dpi \
mate-core \
mate-desktop-environment \
mate-notification-daemon \
indicator-sound-gtk2 \
indicator-application-gtk2 \
ubuntu-gnome-desktop \
gnome-session-flashback \
gnome-panel \
gnome-tweak-tool \
xfce4 \
xfce4-goodies
sudo apt-get autoremove -y
# AUTH POPUP
sudo bash -c 'cat > /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf' << EOF
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.color-manager.create-device" ||
action.id == "org.freedesktop.color-manager.create-profile" ||
action.id == "org.freedesktop.color-manager.delete-device" ||
action.id == "org.freedesktop.color-manager.delete-profile" ||
action.id == "org.freedesktop.color-manager.modify-device" ||
action.id == "org.freedesktop.color-manager.modify-profile") &&
subject.isInGroup("{users}")) {
return polkit.Result.YES;
}
});
EOF
# ALLOW FIREWALL
sudo ufw allow 3389/tcp
# SET SESSION MANGER
if [ -f /home/${USER}/.xsession ]; then
rm -f /home/${USER}/.xsession
fi
cat << 'EOF' >> /home/${USER}/.xsession
export LOGNAME=$USER
export LIBGL_ALWAYS_INDIRECT=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
mate-session # Works
#gnome-session --session=gnome-flashback-metacity --disable-acceleration-check & gnome-panel # Works
#xfce4-session # Works
EOF
chmod +x /home/${USER}/.xsession
# RUN BASH NOT SH
sudo sed -i "s|#\!/bin/sh|#\!/bin/bash|g" /etc/X11/Xsession
# ADD XRDP USER TO SSL-CERT GROUP
sudo adduser xrdp ssl-cert
# XRDP - RESTART
sudo service xrdp restart
# XRDP - STATUS
sudo service xrdp status
@djravine
Copy link
Author

Is there an exact reversal procedure to the listed steps of the script, specifically for removing the added rules?

You could move the conf file that was created into a backup file so it doesn't get run
mv /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf.backup

@creativ-ii
Copy link

worked perfectly

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