Ubuntu 18.04: Connect to LXDE desktop environment via XRDP

This article will describe installing LXDE desktop environment and XRDP, and connecting to LXDE desktop environment via XRDP.

1 Install LXDE desktop environment

Install LXDE desktop environment with this.

2 Install XRDP

Install XRDP.

$ sudo apt install -y xrdp
$ sudo sed -e 's/^new_cursors=true/new_cursors=false/g' \
-i /etc/xrdp/xrdp.ini $ sudo systemctl enable xrdp $ sudo systemctl restart xrdp

3 Create ~/.xsession

Create .xsession in home directory of user to be connected.

$ echo "lxsession -s Lubuntu -e LXDE" > ~/.xsession

4 Disable light-locker via XRDP

The light-locker causes error when lightdm does not executed. This is because light-locker uses XDG_SESSION_PATH which is set by lightdm. XDG_SESSION_PATH is a dynamic value and cannot be set static.

** (light-locker:2769): ERROR **: 08:09:59.625: Environment variable
XDG_SESSION_PATH not set. Is LightDM running?

This article create a wrapper script which checks if XDG_SESSION_PATH is set or not.

$ sudo cp /usr/bin/light-locker /usr/bin/light-locker.orig
$ cat <<EOF | sudo tee /usr/bin/light-locker

# The light-locker uses XDG_SESSION_PATH provided by lightdm.
if [ ! -z "\${XDG_SESSION_PATH}" ]; then
  # Disable light-locker in XRDP.
$ sudo chmod a+x /usr/bin/light-locker

5 Connect to LXDE desktop environment via XRDP

Use Xorg as a session type. Windows Remote Desktop Connection is as the following.