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