Enabling VNC and disabling desktop effects from the command line

Written on Saturday, 2011-02-05 11:38. Updated Monday, 2018-02-05 22:01. Tagged bash, code, and english

Here be dragons! This post is more than three years old. The information and advice it presents may be deprecated, wrong, or unvise. Thread with cation.

Don’t you just hate those days when you need to access the desktop of a machine, but forgot or just never activated remote desktop? Fear not, the following lines will let you activate it from an SSH-shell.

# display number, assuming 0
# get the machine-id
read -r machineid < /var/lib/dbus/machine-id
# source the right file under .dbus to set the needed variables
. "$HOME/.dbus/session-bus/$machineid-$display"
# export the variables sourced from that file
# Run gconftool-2:
# enable desktop sharing
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true
# disable <h3>Sources</h3>You must confirm each access to this machine"
gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false
# enable <h3>Sources</h3>Allow other users to control your desktop"
gconftool-2 -s -t bool /desktop/gnome/remote_access/view_only false

Remeber to set a password after you log in (afaik you can’t set this from cli)

I use the proprietary ATI drivers, and because of a bug I have to disable desktop effects, else the VNC windows will only show me a static desktop and no updates.

# disable desktop effects (if your desktop
gconftool -s -t string /desktop/gnome/applications/window_manager/current /usr/bin/metacity
gconftool -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
sudo reboot


Activate comments