Ubuntu 16.04: Remote connect to Unity with VNC/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

Running the following script will install tigervnc.


# Refresh repository.
sudo apt update -y

# Install git and devscript.
sudo apt install -y git devscript

# Remove vnc4server.
sudo apt remove -y vnc4server

# Create working directory.
mkdir tigervnc
cd tigervnc

# Download source code.
git clone https://github.com/TigerVNC/tigervnc
cd tigervnc/

# Avoid compiler error.
git checkout ff872614b507d0aa8bfbd09ef41550390cfe658a

# Prepare to build package.
ln -s contrib/packages/deb/ubuntu-xenial/debian
chmod a+x debian/rules
sudo apt install -y -o 'apt::install-recommends=true' \
     `dpkg-checkbuilddeps 2>&1 | \
sed -e 's/.*build dependencies://g' -e 's/([^)]*)//g'`

# Build package.
fakeroot debian/rules binary
cd ..

# Install package with resolving dependent package.
sudo dpkg -i *.deb || (sudo apt-get -f install -y ; sudo dpkg -i *.deb || exit 1)
cd ..

2 ${HOME}/.xsession

Create the following .xsession.

$ 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} &


3 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

4 Run VNC server

Create password with vncpasswd.

$ vncpasswd
Would you like to enter a view-only password (y/n)? n

Run vncserver. Remote access port is 5900 + display nummber. A port of below example is 5901.

$ vncserver

New 'ubuntu-16:1 (hiroom2)' desktop is ubuntu-16:1

Starting applications specified in /home/hiroom2/.vnc/xstartup
Log file is /home/hiroom2/.vnc/ubuntu-16:1.log

Connect to vnc://<server>:5901 with remote vnc client. Input password and connection will be completed as below.


5 Run XRDP server

Install xrdp.

$ sudo apt install -y xrdp

Connect to xrdp with rdesktop or "Remote Desktop" on Windows. Input username and password, and connection will be completed.