Seeing the session bus as another user
David Zeuthen
david at fubar.dk
Tue Mar 6 19:18:13 PST 2007
On Tue, 2007-03-06 at 22:12 -0500, David Zeuthen wrote:
> On Wed, 2007-03-07 at 02:44 +0000, Stuart Langridge wrote:
> > I'd like PHP scripts on my machine, running as www-data, to be able to
> > display notifications on my desktop (since someone mentioned that they
> > do a similar trick with Growl on OS X:
> > http://www.aquarionics.com/article/name/Debugging_Ajax and it sounded
> > useful).
>
> I'm pretty sure that programs outside a session should never have access
> to the session bus as that would have severe security implications.
> Instead, I think what you want to do is to make PHP emit signals on the
> system bus (you don't even have to own the service all the time) and
> then your client in the desktop session can pick those up and display
> notifications.
Just doing this
$ dbus-send --system /com/myname/MyPHPApp --type=signal \
com.myname.MyPHPApp.Foo int32:1234 string:some-string
while running dbus-monitor works for me. Btw, this even works for
unprivileged users but I think you can lock that down via a D-Bus
security configuration file that goes in /etc/dbus/system.d so only
www-data can emit signals for the com.myname.MyPHPApp name. Beware that
any user on the system can receive this signal so if you require privacy
you may need to rethink things.
David
More information about the dbus
mailing list