KB 398131 - Setup noVNC on Ubuntu 20.04/Gnome 3.36

KB 398131 - Setup noVNC on Ubuntu 20.04/Gnome 3.36

VNC (Virtual Network Computing) enables you to control your Linux installation from another computer on the same network, by viewing and interacting with the desktop from the other computer. To learn more about VNC, click here 

noVNC allows you to remotely access a machine by simply visiting a web page. This guide will detail how to configure noVNC on Ubuntu.

Setup VNC - vino/gnome-remote-desktop

Vino and gnome-remote-desktop is installed by default on the full installation Ubuntu 20.04, check if it is installed on your version if not install before proceeding.

Enable VNC

  1. Open the Activities overview and start typing Sharing.

  2. Click on Sharing to open the panel.

  3. If the Sharing switch in the top-right of the window is set to off, click to switch it on.

  4. Click Screen Sharing

  5. Set the Screen Sharing switch to on.

  6. Set the Allow connections to control the screen switch to on.

Enable the VNC server to start each time you log in

cd /usr/lib/systemd/user/graphical-session.target.wants
sudo ln -s ../vino-server.service ./.

Configure the VNC server

gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false

Set a password to access the VNC server

# Replace mbuzz123 with your desired password
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password $(echo -n 'mbuzz123'|base64)

Reboot the system so that the settings take effect

sudo reboot
You can now access the remote desktop through VNC clients, like VNC® Viewer, in the local network

Setup noVNC

Install from Snap Package

Running the command below will install the latest release of noVNC from Snap:

sudo snap install novnc

Check the port on which VNC is running

sudo apt install net-tools
sudo netstat -pl | grep vino
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 10580/vino-server
tcp6 0 0 [::]:5900 [::]:* LISTEN 10580/vino-server
You can see vino is running on port 5900, this will be used in the next step:

Run noVNC from Snap as a Service (Daemon)

Create a new service that listens on port 6080 and connects to the VNC server running on port 5900 on localhost:

sudo snap set novnc services.n6080.listen=6080 services.n6080.vnc=localhost:5900

List current services (out-of-box this will be blank):

sudo snap get novnc services
Key             Value
services.n6080  {...}

Using noVNC

Visit http://localhost:6080/vnc.html and input the password you created

You can access this page from other devices in the network as well.
Make sure to enable auto-login from settings to ensure access after a reboot.