Ubuntu 18.04: Connect to GNOME desktop environment via XRDP

This article will describe connecting to GNOME desktop environment via XRDP.

1 Install XRDP

Install xrdp package. If using Xorg as session type, TigerVNC is not needed.

$ sudo apt install -y xrdp

Disable newcursors because black background around cursor is displayed if using Xorg as session type.

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

2 Create ~/.xsessionrc

create ~/.xsessionrc which will export the environment variable for customized settings for Ubuntu.

$ D=/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop
$ cat <<EOF > ~/.xsessionrc
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export XDG_DATA_DIRS=${D}
export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
EOF

3 Authentication Required dialog

If using Xorg as session type, Authentication Required dialog will be displayed after creating session.

0001_AuthenticationRequiredDialog.png

If you success this authentication twice, colord and gsd-color will causes error and XRDP connection will be lost. So add rule which makes this authentication to be failed.

$ cat <<EOF | \
  sudo tee /etc/polkit-1/localauthority/50-local.d/xrdp-color-manager.pkla
[Netowrkmanager]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF
$ sudo systemctl restart polkit

4 Connect to GNOME desktop environment via XRDP

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

0002_xrdp-gnome.png

4.1 rdesktop client with clipboard makes nautilus hang

There is no problem when using Windows Remote Desktop Connection or Remmina.

But rdesktop has a problem. If using rdesktop with enabling clipboard, nautilus on XRDP server will be hang (CPU usage will be high).

So if using rdesktop, please disable clipboard with "-r clipboard:off".

$ rdesktop -r clipboard:off XRDPSERVER