Installing GUI and Configuring Multi User RDP on Ubuntu 22.04

1

Install GNOME Desktop

Ubuntu Server 22.04 typically comes without a GUI. To install the full Ubuntu Desktop:

sudo apt update
sudo apt install ubuntu-desktop -y

If you want minimal GNOME instead of the full Ubuntu Desktop:

sudo apt install gnome-session gdm3 -y
2

Install and configure xRDP

Install xRDP and enable/start the service:

sudo apt install xrdp -y
sudo systemctl enable xrdp
sudo systemctl start xrdp
3

Use gnome-session for RDP

Edit the Xsession startup file:

echo "gnome-session" > ~/.xsession

For root:

sudo mkdir -p /root
echo "gnome-session" | sudo tee /root/.xsession
4

Make the session end with RDP

The black screen issue can occur because the Xorg session persists after the RDP connection ends. To force the session to close when the RDP connection ends, modify xrdp-sesman:

Open/etc/xrdp/sesman.ini
sudo nano /etc/xrdp/sesman.ini

Set these values in the file:

  • KillDisconnected=TRUE

  • DisconnectedTimeLimit=0

Explanation:

  • KillDisconnected=TRUE → Ends the session when disconnected

  • DisconnectedTimeLimit=0 → No delay

Restart xRDP:

sudo systemctl restart xrdp
5

Allow root login via RDP (optional)

By default, xRDP blocks root login. To allow root login, update the sesman.ini setting and restart xRDP:

sudo sed -i '/AllowRootLogin/s/0/1/' /etc/xrdp/sesman.ini
sudo systemctl restart xrdp
6

Create additional users for multi-session RDP

Create users (example: user1 and user2):

sudo adduser user1
sudo adduser user2

Give them sudo privileges. (Optional)

sudo usermod -aG sudo user1
sudo usermod -aG sudo user2

Set .xsession for each user:

for user in user1 user2; 
do
  sudo -u $user bash -c 'echo "gnome-session" > ~/.xsession'
done

Last updated

Was this helpful?