(This question has identical title, but question body asks it in scripting point of view, e.g. su -c
, don't dupe this to that)
I have a Qt GUI app that needs to perform some file operations in /etc based on user input. One option would probably to use system()
with sudo
, but even that requires messing with sudoers
file in some point. I also would like not to do system()
plus script hacks to modify the files, but proper file operations.
What is the best way to programmatically elevate my applications rights to do this?
Edit: as a bonus, it'd be nice if it would work on Maemo/Meego/other handhelds too (afaik PolicyKit isn't available there..)
I would write a separate program altogether. Something along the lines of this philosophy. Basically - write a simple program that does exactly what you need, and control its behaviour with file permissions on the filesystem. Mainly,
And,