Fwd: connect to session bus from root app

Sergei Lopatin magist3r at gmail.com
Thu Apr 16 15:02:38 PDT 2015

Hi all!

I try to connect to user session bus from my Qt root app. Unfortunately, I
can't do this right.

First, I share DBUS_SESSION_BUS_ADDRESS variable with my app.
Second, I use setuid(1000) in my app to set user ID.
And all works fine! But.. I can't get root rights back when setuid is used.
But if I use seteuid instead of setuid, session bus is unavailable.

So, my question is why seteuid is not enough to get access to user session
bus? Maybe I do something wrong?

FYI: I need root privileges to access system devices directly and session
bus to set inhibitions preventing sleep/idle.

Best regards, Sergei Lopatin
e-mail: magist3r at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20150417/b1adbcbf/attachment.html>

More information about the dbus mailing list