Let root query screensaver status for user

Johannes Bauer dfnsonfsduifb at gmx.de
Fri Nov 9 08:39:08 PST 2012


On 09.11.2012 17:21, Thiago Macieira wrote:

> Actually, yes.
> 
> The --address option creates a peer-to-peer connection. The dbus-send tool 
> will try to send that call without initiating a Hello on the bus. So it will 
> not work. dbus-send is missing a --bus-address option.
> 
> Set DBUS_SESSION_BUS_ADDRESS to the address you found, then use --session.

Ah! Indeed this works:

sudo -u joe
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-8IESNc9oG8,guid=d24391749481b41b3255eadf509aec5e
dbus-send --session --dest=org.gnome.ScreenSaver --type=method_call
--print-reply /org/gnome/ScreenSaver org.gnome.ScreenSaver.GetActive

Which brings me to the next question: Is there a way that I can
determine the DBUS_SESSION_BUS_ADDRESS for user joe from my root account
(without having to manually set it)?

Thank you & best regards,
Johannes


More information about the dbus mailing list