Authenticating GTK app to run with root permissions
Posted
by Thomas Tempelmann
on Stack Overflow
See other posts from Stack Overflow
or by Thomas Tempelmann
Published on 2010-03-08T11:38:46Z
Indexed on
2010/03/08
23:36 UTC
Read the original article
Hit count: 360
I have a UI app (uses GTK) for Linux that requires to be run as root (it reads and writes /dev/disk*).
Instead of requiring the user to open a root shell or use "sudo" manually every time when he launches my app, I wonder if the app can use some OS-provided API to ask the user to relaunch the app with root permissions. (Note: gtk app's can't use "setuid" mode, so that's not an option here.)
The advantage here would be an easier workflow: The user could, from his default user account, double click my app from the desktop, and the app then would relaunch itself with root permission after been authenticated by the API/OS.
I ask this because OS X offers exactly this: An app can ask the OS to launch an executable with root permissions - the OS (and not the app) then asks the user to input his credentials, verifies them and then launches the target as desired.
I wonder if there's something similar for Linux (Ubuntu, e.g.)
Update:
The app is a remote operated disk repair tool for the unsavvy Linux user, and those Linux noobs won't have much understanding of using sudo or even changing their user's group memberships, especially if their disk just started acting up and they're freaking out. That's why I seek a solution that avoids technicalities like this.
© Stack Overflow or respective owner