This is a lightly modified version of the answer I posted here. I'm copying it over because this was marked as a related question, and it seems to have much more traffic than the other one, so an answer here would likely be able to help more people.
Elementary OS does not currently come with a GUI frontend for setting up a VNC server, most likely due to the fact that elementary OS exclusively uses its own GUI applications built from scratch in Vala, and building a GUI frontend for setting up a VNC server is just a relatively low priority. It would be a good project for a Settings panel at some point, though.
We are going to use
x11vnc, which is a fairly simple, fairly generic VNC server that works well with Pantheon and supports connecting to the login screen (i.e. after startup and before logging in).
x11vnc is conveniently available from elementary OS's
apt repositories (which for elementary OS Odin are Canonical's repositories for Ubuntu 20.04 LTS Focal Fossa). It has tons and tons of options that we're just not going to use. There are other VNC servers you can use that among other things may have commercial support. Because you're here, I'm assuming you're not using one of them, so
x11vnc it is.
We are going to use the command line in order to keep things as simple as possible.
These instructions are adapted from, among other things, this tutorial, which worked for me.
- You will need
- You will need to set up OpenSSH if you haven't done so already.
Note: These instructions do not include steps for VNC authentication or allowing VNC through the firewall because it assumes you will use an SSH tunnel. This keeps things simple and also more secure.
If you haven't set up SSH, in order to do so in the very most basic way with default settings, run each of the following commands in Terminal:
$ sudo apt install openssh-server -y
$ sudo systemctl enable ssh
$ sudo systemctl start ssh
$ sudo ufw allow ssh
In Terminal (or over SSH):
$ sudo apt install x11vnc -y
systemd service (so
x11vnc runs automatically)
Open a new file in
$ sudo nano /etc/systemd/system/x11vnc.service
Paste this into the file:
Description=Start x11vnc at startup.
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbport 5900 -shared -o /var/log/x11vnc.log
Save the file by typing
Ctrl-O and exit
nano by typing
Enable and start the
$ sudo systemctl enable x11vnc
$ sudo systemctl start x11vnc
x11vnc should now be running, and it should start automatically whenever you log in locally.
To log in remotely
Note: This is assuming the client machine is on the same local network as the host machine. If you are connecting to the host machine over WAN, I'll assume you already know the public hostname or IP address.
Gather the necessary information
To get the host machine's hostname, on the host machine, run:
This should print the host machine's hostname, e.g.
If, further in the instructions, the hostname doesn't work, you can use the IP address instead. To get the host machine's IP address, on the host machine, run:
$ hostname -I
This should print all of the host machine's IP addresses, like so:
192.168.XXX.XXX [a bunch of ipv6 addresses follow]
You can probably just use the first one, i.e. the ipv4 address.
Enter the information on the client computer
On the client computer, use the following information:
- The hostname, e.g.
.local, or the IP address from above
22, i.e. SSH
- Whatever login information you use for SSH, which should by default be your local login username and password on the host computer
Example client setup: Edovia Screens
Note: My client computer is a MacBook, and I'm using Edovia Screens because Apple Screen Sharing doesn't like the authentication we're using. Because it's what I'm using to test these instructions as I write them, the following instructions use Edovia Screens as the example. If I figure out a way to use Apple Screen Sharing I'll update these instructions. If someone with edit privileges wants to add examples for other client platforms, feel free.
- In Edovia Screens, click the
+ icon in the toolbar and select
- In the first popup, click
- In the second popup, enter the information as follows:
Name is the "pretty" display name for the bookmarked host computer, e.g.
Foo Bar (i.e. you can use capitalization and spaces)
Address or Hostname is the hostname or IP address from above, e.g.
Operating System is
Authentication type is
- Click on the
Secure Connection tab and do the following:
Enable Secure Connections
- Enter your local login username and password from the remote computer (unless you are using SSH keys)
Enable Secure Connections on Local Network
Your Linux computer should now appear in the lefthand side of the main Edovia Screens window, with an illustration of Tux the penguin. (This image will be replaced with a screenshot each time you close a VNC session.)
To open a VNC connection to the host computer, double-click on the representation of it in the main Edovia Screens window.
- I haven't tested this with any clients other than Edovia Screens. My apologies that I'm only testing this on a piece of paid Mac software that costs $30.
- This is almost certainly not the best way of doing things. It's just relatively simple and relatively secure.
- I haven't tested this using a host computer with multiple login (i.e. human) user accounts. If you have multiple login users on your host computer, you may have to do additional configuration.
- While you do need
sudo privileges in order to set this up, I don't know if you need
sudo privileges in order to log in remotely (i.e. on a managed host computer where some login users may not have