Ubuntu 16.04: Remote connect to GNOME Classic Desktop with VNC/XRDP

This article will describe installing tigervncserver and connecting to GNOME Classic Desktop with VNC and XRDP. Please see here for connecting Unity.

And remote connect to GNOME3 with tightvncserver will cause aborting.

 

1 Preparation

Remove vnc4server and tightvncserver.

You can also switch vncserver to tigervncserver with update-alternatives command.

$ sudo apt remove -y vnc4server tightvncserver

Install git and devscripts.

$ sudo apt install -y git and devscripts

Install packages for GNOME Classic Desktop.

$ sudo apt install -y gnome-panel metacity

2 Install tigervncserver

tigervnc repository already has a devscripts files for Ubuntu 16.04.

I with that tigervnc ported to xenial-update.

 

Download tigervnc from repository. Checkout with hash which was used by this article.

$ mkdir tigervnc
$ cd tigervnc
$ git clone https://github.com/TigerVNC/tigervnc
$ cd tigervnc/
$ git checkout 044e2b87da7121ef6cbd59e88b101d7d8e282896 \
-b 044e2b87da7121ef6cbd59e88b101d7d8e282896

Move devscripts files to the top of directory with symbolic link.

$ ln -s contrib/packages/deb/ubuntu-xenial/debian

Install packages for building tigervnc.

$ sudo apt install -y $(grep Build-Depends: debian/control | \
sed -e 's/Build-Depends://g' -e 's/([^\)]*)//g' -e 's/,//g')

Build tigervnc.

$ chmod a+x debian/rules
$ fakeroot debian/rules binary

Install deb files while installing depend package with running "apt -f install".

$ cd ..
$ sudo dpkg -i *.deb || (sudo apt -f install -y; sudo dpkg -i *.deb)
$ cd ..

3 ${HOME}/.xsessionrc

This article will not use .vnc/.xstartup and .xsession, will use .xsessionrc which run program for GNOME Classic Desktop.

$ cat <<EOF > ~/.xsessionrc
gnome-panel &
metacity &
EOF
$ rm ~/.xsession

4 Run VNC server

Create password with vncpasswd.

$ vncpasswd
Password:
Verify:
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.

0001_VNC.png

5 Run XRDP server

Install and run xrdp.

$ sudo apt install -y xrdp
$ sudo systemctl enable xrdp
$ sudo systemctl restart xrdp

Connect to xrdp with rdesktop or "Remote Desktop" on Windows.

Input username and password, and connection will be completed. 

0002_XRDP.png