[Interest] Qt, running as root (sudo/setuid), DBus and OS X

Roland Hughes roland at logikalsolutions.com
Sun Sep 18 19:23:11 CEST 2016


 >>

Hi,

Is it possible to use Qt-based applications on OS X that run with elevated privileges (= as root), in general and if they need to connect to the user's session dbus?

---

Typically you need to look at QApplication documentation. There is 
something you have to set in that class BEFORE you instantiate it. If 
that is not set Qt will block priv elevations. On Linux which, OS x is 
just the cheaper less capable BSD, you can then use "capabilities" 
(forget the correct name) library which allows a user app to temporarily 
elevate its privs for certain things.

Of course, you might wish to check the myriad of "groups" a user account 
can belong to. Many times you can simplify things by requiring the 
install to have the user be added to a group. This is typical with 
things which access the serial port. User needs to be in dialout or 
modem or whatever group. This approach is actually safer than temporary 
boost of privs because, in theory, the app could crash while boosted 
leaving the user running as root.

Roland




More information about the Interest mailing list