Simplest way to configure VNC Server in Xubuntu (18.10, 18.04 LTS, 17.10, 17.04, 16.10, 16.04 LTS)

After installing Xubuntu I noticed that there was no Desktop Sharing option and most of the results I googled involved setting up and configuring tightvncserver, which was not as simple as I would had hoped since you had to deal with X sessions.

I literally just want to connect to my PC from my iPad when I’m using it on the couch.

Reading the official documentation, they mention that vino is the default server, but the instructions expect a GNOME desktop. vino is not installed by default in XFCE.

It was pretty straightforward to configure, but for some reason I couldn’t find updated instructions during a quick search, so I had to update the instructions from an older blog post.

1. Install vino

$ sudo apt-get install vino

2a. Configure vino (Xubuntu 16.04 LTS to 17.10)

$ vino-preferences
vino-preferences

2b. Configure vino (Xubuntu 18.04 LTS to 18.10)

The vino project removed vino-preferences in version 3.0 to integrate better with gnome-control-center, which leaves us with no graphical way to configure it under XFCE.

We will need to use the gsettings command line tool to change the preferences, for convenience, these are the preferences that were exposed in vino-preferences:

#
# Display all the preferences
#
gsettings list-recursively org.gnome.Vino
#
# [x] Allow other users to view your desktop
# NOTE: This setting was removed
#
gsettings set org.gnome.Vino enabled true
#
# [x] Allow other users to control your desktop
# NOTE: Reverse Boolean
#
gsettings set org.gnome.Vino view-only false
#
# [ ] You must confirm each access to this machine
#
gsettings set org.gnome.Vino prompt-enabled false
#
# [ ] Require the user to enter this password
#
gsettings set org.gnome.Vino authentication-methods "['none']"
gsettings set org.gnome.Vino vnc-password keyring
#
# [x] Require the user to enter this password
#
# Step 1. Ask for password (NOTE: Only tested with `bash` and `zsh`)
echo -n "VNC Password: " && read -s password < /dev/tty && echo ""
# Step 2. Set the preferences
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password "$(echo $password | base64)"
# Step 3. Clear the `$password` variable
unset password
#
# [ ] Automatically configure UPnP router to open and forward ports
#
gsettings set org.gnome.Vino use-upnp false
#
# Show Notification Area Icon
#
# ( ) always // Always
# (o) client // Only when someone is connected
# ( ) never // Never
#
gsettings set org.gnome.Vino icon-visibility client

3. Disable encryption (optional)

$ gsettings set org.gnome.Vino require-encryption false

Disabling encryption may sound like heresy nowadays, but if you are just trying to connect in your LAN at home you should be fine. OTOH, some clients like TightVNC for Windows do not work with encryption anymore because older protocols like SSLv3 and TLSv1 have been deprecated.

4. Activate at startup

$ xfce4-session-settings

Check Desktop Sharing (GNOME Desktop Sharing Server) under the Application Autostart tab.

xfce4-session-settings

If the Desktop Sharing entry is missing, you will need to add it by running the following command:

$ sudo cp /usr/share/applications/vino-server.desktop /etc/xdg/autostart/vino-server.desktop

5. Test it

$ /usr/lib/vino/vino-server --sm-disable

6. Reboot