Let root query screensaver status for user

Krzysztof Konopko krzysztof.konopko at youview.com
Fri Nov 9 08:10:18 PST 2012


Hmmm... weird. It works for me with --session

[krzysztof.konopko at some-pc]$ su -
[root at some-pc ~]# sudo -u krzysztof.konopko dbus-send --session \
--dest=org.gnome.ScreenSaver --type=method_call --print-reply \
/org/gnome/ScreenSaver org.gnome.ScreenSaver.GetActive

method return sender=:1.58 -> dest=:1.240 reply_serial=2
   boolean false

It doesn't work with --address though.

Are you sure that user 'joe' is logged in?
Is there any specific entry for the root user (or any group that root
belongs to) in your /etc/sudoers?

Kris

On 09/11/12 15:36, Johannes Bauer wrote:
> 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
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
> 



More information about the dbus mailing list