I'm working on an installer program which potentially asks the user for the right to perform administrative actions (e.g. writing to the global program files directory and changing registry keys).
Windows allows using runas
and OS X has AuthorizationExecuteWithPrivileges
. Linux doesn't seem to feature anything like this.
I considered implementing this functionality by calling out to sudo
, but that has a number of downsides:
- It's not always installed by default.
- Even if it's installed, it may fail if the current user is not part of the 'sudoers' group.
- The password prompt differs between
sudo
versions (sometimes thep
inpassword:
is upper case). sudo
output is affected by the system language.
I could overcome the last two items, but the first two are kind of showstoppers. I wonder - are there other common approaches to implement this for Linux?