Let root query screensaver status for user

Johannes Bauer dfnsonfsduifb at gmx.de
Fri Nov 9 07:36:58 PST 2012


On 09.11.2012 16:19, Krzysztof Konopko wrote:

> It's tempting to add <allow user="root"> in session.conf or
> session-local.conf but I wouldn't recommend that. Instead why don't you
> just call sudo -u <your user> dbus-send (or with su) instead?

Ah, good idea, but it doesn't seem to work:

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

Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply.
Possible causes include: the remote application did not send a reply,
the message bus security policy blocked the reply, the reply timeout
expired, or the network connection was broken.

Also instead of "--address" I tried "--session" which gave me:

Failed to open connection to "session" message bus: /usr/bin/dbus-launch
terminated abnormally with the following error: No protocol specified
Autolaunch error: X11 initialization failed.

Is this supposed to happen?

Best regards and thanks for your help,
Joe


More information about the dbus mailing list