hild1.no

Kagee's random rantings

Enabling VNC and Disabling Desktop Effects From the Command Line

Don't you just hate those day when you really 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 a SSH-shell:

[code language="bash" light="true"]
# display number, assuming 0
display=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
export DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID DBUS_SESSION_BUS_WINDOWID

# Run gconftool-2:

# enable desktop sharing
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true

# disable "You must confirm each access to this machine"
gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false

# enable "Allow other users to control your desktop"
gconftool-2 -s -t bool /desktop/gnome/remote_access/view_only false
[/code]

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

I use the propiatary 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:

[code language="bash" light="true"]
# 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
[/code]

Sources

https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/353126
http://ubuntuforums.org/showthread.php?t=1518231