Getting DBUS_SESSION_BUS_ADDRESS

Here is how you can get the DBUS environment variable needed to (for example) disable gnome-screensaver. You need this if you log in via ssh and want to control something in GNOME or other environments.

strings /proc/`ps aux | awk '/gnome-screensave?r/ {print $2}'`/environ | grep DBUS_SESSION

Example:

clopez@pete29:~$ strings /proc/`ps aux | awk '/gnome-screensave?r/ {print $2}'`/environ | grep DBUS_SESSION
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Iro70iINtY,guid=48f12b46525ef0b9d0fee020c1a09900

Then you can do:

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Iro70iINtY,guid=48f12b46525ef0b9d0fee020c1a09900 gnome-screensaver-command -d

DebianNotes/Dbus (last edited 2009-06-27 16:03:03 by SamatJain)