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