Accessing Session Bus through the superuser
Thiago Macieira
thiago at kde.org
Mon Mar 17 00:38:15 PDT 2008
Ozan Çağlayan wrote:
>Hi,
>
>I'm trying to access the Session Bus for sending notifications to
>desktop through the superuser. I wrote a python script which acts like a
>regular user which has an X Display and an address for accessing its
>session bus. It works perfectly when run as root:
Ok, stop.
That's not a good practice. Instead, let the user connect to the system
bus and receive the notifications there. Do not push messages into the
session bus.
If three users are logged in now, in 4 different sessions, how do you know
which session bus to connect to? In most cases, you've chosen the wrong
one, so do as I say: the user connects to the system bus.
> dbus.exceptions.DBusException:
>org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to
>autolaunch D-Bus session: 6360: Autolaunch enabled (using X11).
>6360: --exit-with-session automatically enabled
>No protocol specified
>Autolaunch error: X11 initialization failed.
The X server refused the connection. In itself, it's not a D-Bus problem.
But:
>It's trying to autolaunch a session bus using dbus-launch but it fails.
>
>What I can't understand is why "exporting an object over the system bus"
>is triggering this error?
I don't either. The environment variable you set with the D-Bus session's
bus address did not take effect. Review your script to see if setting the
environment is working.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080317/72844d79/attachment.pgp
More information about the dbus
mailing list