Sending dbus events to a session bus as another user

Kalle Vahlman kalle.vahlman at gmail.com
Mon Apr 9 04:07:04 PDT 2007


2007/4/9, Carl van Tonder <simplyw00x at gmail.com>:
> My .procmailrc line looks like this:
>         | formail -fc -x Subject |  sed -e 's/carl.*2007  //' | sed -e
>         's/<.*>//' | sed -e 's/^/\"/g' | sed -e 's/$/\"/g' | xargs -t sudo -u
>         carl notify-send -i stock_mail "New Mail"
>
> The problem, predictably, is that whichever user procmail is running as
> (plainly not me), it doesn't have access to my d-bus session:
> libnotify-Message: Unable to get session bus: Failed to execute dbus-launch
> to autolaunch D-Bus session
>
> The interesting thing is that I've tried (as you can see in the example) using
> `sudo -u carl` to run notify-send as my user (which interestingly works in a
> root shell, but not here), and tried exporting $DBUS_SESSION_BUS_ADDRESS
> to the value it has during my own session, but that doesn't even work in a root
> shell (http://gnome-hacks.web.com/hacks.html?id=82 claims that it should).
>
> So, gods of d-bus, can you help me in my trivial (but immensely
> frustrating) plight?

I dunno if I qualify even as a demigod of D-Bus, but I recently
noticed that notify-send required the DISPLAY env var to be set for it
to work in my similar hack to get notifications from 'emerge'. Perhaps
that would solve it for you too?

-- 
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi


More information about the dbus mailing list