Skip to content

Instantly share code, notes, and snippets.

@nestoru
Last active August 30, 2021 12:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nestoru/fee24a59804d60ccba1a to your computer and use it in GitHub Desktop.
Save nestoru/fee24a59804d60ccba1a to your computer and use it in GitHub Desktop.
Install XRDP in Ubuntu
#!/bin/bash -e
#
# ubuntu-install-xrdp.sh
# Tested in Ubuntu 20.04: Bidirectional clipboard does work.
#
# One line installer (change ubuntu by the username that you want to remotely login):
# curl -L https://gist.github.com/nestoru/fee24a59804d60ccba1a/raw | sudo bash -s ubuntu
#
START=$(date +%s)
if ! [ $(id -u) = 0 ]; then
echo "I will work only under root!"
exit 1
fi
USAGE="Usage: `basename $0` <user>"
if [ $# -ne "1" ]
then
echo $USAGE
exit 1
fi
user=$1
if [ "$user" == "root" ]; then
user_home=/root
else
user_home=/home/$user
fi
apt-get update -y
apt-get install -y ubuntu-desktop
apt-get install -y xrdp
adduser xrdp ssl-cert
systemctl restart xrdp
echo Run the below commands if RDP is still not running to find out the cause:
echo " sudo systemctl status xrdp"
echo " tail -100 /var/log/xrdp-sesman.log"
END=$(date +%s)
DIFF=$(( $END - $START ))
echo "Finished in $DIFF seconds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment