Ubuntu 16.04: Connect to Unity desktop environment via XRDP

In order to the article of Griffon's IT Library, adding "unity" to .xsession will enable Unity remote desktop. This article will describe installing tigernvc and creating .xsession which call unity, some indicator and more. This will be similar with desktop on local machine.

1 Install TigerVNC

Install TigerVNC with the following script.

#!/bin/sh

set -e

# Install TigerVNC.
sudo apt remove -y vnc4server
sudo apt-get install -y git devscripts xserver-xorg-dev

mkdir tigervnc
cd tigervnc

git clone https://github.com/TigerVNC/tigervnc
cd tigervnc/
git checkout ff872614b507d0aa8bfbd09ef41550390cfe658a

ln -s contrib/packages/deb/ubuntu-xenial/debian
chmod a+x debian/rules
sudo apt install -y $(dpkg-checkbuilddeps 2>&1 | \
                        sed -e 's/.*build dependencies://g' -e 's/([^)]*)//g')
fakeroot debian/rules binary
cd ..

sudo dpkg -i ./*.deb || (sudo apt -f install -y && sudo dpkg -i ./*.deb)
cd ..

2 Install XRDP

Install XRDP.

$ sudo apt install -y xrdp

3 Create ~/.xsession

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

$ cat ~/.xsession
/usr/lib/gnome-session/gnome-session-binary --session=ubuntu &
/usr/lib/x86_64-linux-gnu/unity/unity-panel-service &
/usr/lib/unity-settings-daemon/unity-settings-daemon &

for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; do
  basename=`basename ${indicator}`
  dirname=`dirname ${indicator}`
  service=${dirname}/${basename}/${basename}-service
  ${service} &
done

unity

4 Add gnome-control-center

With this article's configuration, selecting "Sytem settings…" at the upper right will call gnome-control-center instead of unity-control-center. Add gnome-control-center which is symbolic link to unity-control-center.

$ sudo ln -s /usr/bin/unity-control-center /usr/bin/gnome-control-center

5 Connect to KDE desktop environment via XRDP

The "Microsoft Remote Desktop" connection is as the following.

0002_XRDP.png