Objective

The following tutorial will explain how to setup client/server remote desktop sharing on Ubuntu 18.04 Bionic Beaver.

Operating System and Software Versions

  • Operating System: - Ubuntu 18.04 Bionic Beaver

Requirements

Privileged access to your Ubuntu System as root or via sudo command is required.

Difficulty

EASY

Conventions

  • # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - requires given linux commands to be executed as a regular non-privileged user

Instructions

Enable Remote Desktop Sharing

To begin, we first need to make sure that remote desktop sharing is installed on the target Ubuntu system:
$ sudo apt update && sudo apt install -y vino
Next, step is to enable remote sharing:
Ubuntu Remote Desktop - Sharing Settings
Use Activities menu to search for Sharing as part of System settings section. Alternately, execute the command gnome-control-center sharing to bring up remote desktop sharing settings window.


Ubuntu Screen Sharing configuration
Click on Screen Sharing to begin the remote desktop configuration.
Ubuntu Remote Desktop - enable
Make sure that all switches are set to ON. In case you have multiple Networks select which network will be used for remote desktop sharing. Set password if necessary.

The Allow connections to control the screen option gives a remote user the ability to actively interact with a remote desktop. If this option is NOT ticked, the remote desktop session will be set as read-only.
Once the Ubuntu's remote desktop feature is enabled you can optionally confirm that your system is now listening on the port 5900.

Open up terminal and enter:
$ ss -lnt
State       Recv-Q Send-Q Local Address:Port               Peer Address:Port
LISTEN      0      128       0.0.0.0:22                    0.0.0.0:*
LISTEN      0      5       127.0.0.1:631                   0.0.0.0:* 
LISTEN      0      128     127.0.0.1:6010                  0.0.0.0:* 
LISTEN      0      128       0.0.0.0:38299                 0.0.0.0:*
LISTEN      0      5         0.0.0.0:5900                  0.0.0.0:* 
LISTEN      0      128          [::]:22                       [::]:* 
LISTEN      0      5           [::1]:631                      [::]:* 
LISTEN      0      128         [::1]:6010                     [::]:* 
LISTEN      0      128          [::]:39717                    [::]:* 
LISTEN      0      5            [::]:5900                     [::]:*
In case you have the UFW firewall enabled, open the port 5900 for incoming connections:
$ sudo ufw allow from any to any port 5900 proto tcp
Rule added
Rule added (v6)
If you wish to make your firewall rules more strict visit our How to Open/Allow incoming firewall port guide for more information.

Establish Remote Desktop Connection

At this stage we are ready to turn our attention to a client system from which we will be establishing connection to a remote Ubuntu desktop.


Remina Desktop Client

The first remote desktop client we are going to use to create a remote desktop connection is Remmina.

Remmina remote desktop client should already be installed on your Ubuntu 18.04 system. In case you need to install it execute:
$ sudo apt install remmina
Use the activities menu to search and start the Remmina remote desktop client or run the command:
$ remmina
establish quick ubuntu remote desktop connection
Select the VNC protocol from the drop down menu and enter the Ubuntu remote desktop system's host name or the IP address. Hit ENTER to start a quick remote desktop connection.

Alternatively, hit the + button and see below on how to set more options for your remote desktop connection.
settings for remote desktop sharing
Insert any arbitrary name for your remote desktop connection. Select the VNC protocol and set Quality or Color depth. If you wish to save this connection for next time use, hit Save and Connect or simply hit the Connect button.
accept remote desktop connection on server
Once the remote desktop client attempts to establish connection, the remote desktop server needs to accept this connection. On your remote desktop server hit Accept.

If you missed this message, click on Date & Time on the top panel and search for the Another user is trying to view your desktop notification.
Ubuntu remote desktop connection settings
The remote desktop sharing connection was successful. Use the Remmina panel to further tweak your remote desktop connection settings.


VNC Remote Desktop Client

Yet, another alternative to connect to a Ubuntu remote desktop sharing is by use of VNC client. First, install VNC on your client Ubuntu system:
$ sudo apt install tigervnc-viewer
Unlike the above Remina remote client the VNC client does not support encryption. Any attempt to connect to a Remote desktop sharing server will result in No matching security types error.
No matching security types
Connecting to remote desktop using VNC client with encryption enabled causes No matching security types error.
From this reason we first need to disable encryption on remote Vino desktop sharing server. Execute the following linux command to disable the remote server to require an encryption for connecting VNC clients:
$ gsettings set org.gnome.Vino require-encryption false
Confirm that the encryption on your remote server is disabled:
$ gsettings list-recursively org.gnome.Vino | grep encrypt
org.gnome.Vino require-encryption false
Given that the encryption is now disabled, to add some level of privacy you may optionally first create SSH tunnel to your remote desktop for your VNC client on port 5900 before making VNC connection.

We should now be able to connect to a remote desktop using vncviewer command:
$ vncviewer ubuntu-remote-desktop
Accept the remote VNC connection request
Accept the remote VNC connection request.
Connected to remote desktop sharing via VNC client - Ubuntu 18.04
Connected to remote desktop sharing via VNC client - Ubuntu 18.04
ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME or create a JOB ALERT on LinuxCareers.com job portal.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.