Let root query screensaver status for user

Thiago Macieira thiago at kde.org
Fri Nov 9 08:21:27 PST 2012


On sexta-feira, 9 de novembro de 2012 16.36.58, 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=d24391749481b41b3255eadf5
> 09aec5e" --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.

> Is this supposed to happen?

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.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20121109/1081acdf/attachment.pgp>


More information about the dbus mailing list