Skip to content

Instantly share code, notes, and snippets.

@samba
Last active January 24, 2024 00:56
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save samba/69e1ca11f9d04f218b9b to your computer and use it in GitHub Desktop.
Save samba/69e1ca11f9d04f218b9b to your computer and use it in GitHub Desktop.
Activate VNC support in Ubuntu, from command-line (for active sessions)
#!/bin/sh
# This assumes you have access to the system via SSH already, and need
# remote VNC access as the same user, and you want only the primary display.
export DISPLAY=:0
# Encoded password with http://www.motobit.com/util/base64-decoder-encoder.asp
export VNC_PASSWORD="dm5jX3Bhc3N3b3JkNzE=" # vnc_password71
export VNC_PASSWORD="dm5jX3Bhc3M=" # vnc_password (a character limit is enforced?)
# Sadly many common VNC clients don't support encryption.
export USE_ENCRYPTION=false # alternatively "true"
# Set a bunch of useful defaults. (for remote support cases.)
gsettings reset org.gnome.Vino network-interface
gsettings set org.gnome.Vino enabled true
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino notify-on-connect true
gsettings set org.gnome.Vino require-encryption ${USE_ENCRYPTION}
gsettings set org.gnome.Vino vnc-password "${VNC_PASSWORD}"
# List all current settings
for i in `gsettings list-keys org.gnome.Vino`; do
echo $i `gsettings get org.gnome.Vino $i`;
done
# Run the server
/usr/lib/vino/vino-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment