Skip to content

Instantly share code, notes, and snippets.

@lukaszjablonski
Created April 23, 2023 16:42
Show Gist options
  • Save lukaszjablonski/8b61db9331b3082d9e40b7e2f1cdcfa5 to your computer and use it in GitHub Desktop.
Save lukaszjablonski/8b61db9331b3082d9e40b7e2f1cdcfa5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Install and fix issues of xrdp on Ubuntu (tested on 22.04)
# v1.0.0
#
# References:
# * https://askubuntu.com/questions/1398732/multiple-users-use-linux-pc-at-the-same-time/1419949#1419949
# * https://superuser.com/questions/1479313/how-do-i-get-the-full-ubuntu-gnome-experience-via-xrdp/1655262#1655262
# * http://c-nergy.be/blog/?p=14051
# Install xrdp
sudo apt install xrdp
# Fix lack of dash as well as minimize and maximize buttons
sudo sed -i '4 i\export XDG_CURRENT_DESKTOP=ubuntu:GNOME' /etc/xrdp/startwm.sh
sudo sed -i '4 i\export GNOME_SHELL_SESSION_MODE=ubuntu' /etc/xrdp/startwm.sh
sudo sed -i '4 i\export DESKTOP_SESSION=ubuntu' /etc/xrdp/startwm.sh
# Fix authentication requests to create managed color device
sudo sed -i '$ a\[Allow Colord all Users]' /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
sudo sed -i '$ a\Identity=unix-user:*' /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
sudo sed -i '$ a\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' /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
sudo sed -i '$ a\ResultAny=no' /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
sudo sed -i '$ a\ResultInactive=no' /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
sudo sed -i '$ a\ResultActive=yes' /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
# Fix authentication required to refresh system repositories
sudo sed -i '$ a\[Allow Package Management all Users]' /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
sudo sed -i '$ a\Identity=unix-user:*' /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
sudo sed -i '$ a\Action=org.freedesktop.packagekit.system-sources-refresh' /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
sudo sed -i '$ a\ResultAny=yes' /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
sudo sed -i '$ a\ResultInactive=yes' /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
sudo sed -i '$ a\ResultActive=yes' /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
# Run xrdp service
sudo systemctl enable xrdp --now
sudo systemctl start xrdp
echo -n "xrdp "
sudo systemctl is-enabled xrdp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment