Skip to content

Instantly share code, notes, and snippets.

@subfuzion
Last active October 1, 2024 07:58
Show Gist options
  • Save subfuzion/37b316db7b4f88c8296216609c79fdfd to your computer and use it in GitHub Desktop.
Save subfuzion/37b316db7b4f88c8296216609c79fdfd to your computer and use it in GitHub Desktop.
Enable VNC on Ubuntu 23.04 from the command line

Unfortunately, Ubuntu 23.04 no longer supports VNC out of the box, only RDP.

Previous support was based on vino. You can enable this from the command line with the following instructions.

Create a password that you want to use for logging into vnc and save it in a variable:

password=$(echo "some-password" | base64)

Run the following:

sudo apt update -y && sudo apt install -y vino

# open the port in the firewall
sudo ufw allow from any to any port 5900 proto tcp

# some of the following settings depend on capabilities of your vnc client
gsettings set org.gnome.Vino enabled true
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino require-encryption false
gsettings set org.gnome.Vino vnc-password "'$(echo -n $password | base64)'"

Remove the password variable:

unset password

Start vino

systemctl --user start vino-server
# or
/usr/lib/vino/vino-server
# or
/usr/lib/vino/vino-server --display=$DISPLAY
# or if necessary:
DISPLAY=:0 /usr/lib/vino/vino-server

Enable autostart: see these answers.

Note

To see all the keys that can be set and their current values:

gsettings list-recursively org.gnome.Vino

or to just see the keys:

gsettings list-keys org.gnome.Vino
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment