I have created a Mac OS X helper application that always runs under root. I need to launch other application from it, but not as root. I want it to be launched from the current logged in user (not sudoed root).
I've tried to use [NSTask launchedTaskWithLaunchPath:arguments:]
and many other methods, but they all use root privileges to launch my application.
How can I launch my application from helper as a current Mac OS X logged in user?
in the Directory Utility window, then enter an administrator name and password. From the menu bar in Directory Utility: Choose Edit > Enable Root User, then enter the password that you want to use for the root user. Or choose Edit > Disable Root User.
You can disable it from the Directory Utility, which you can access as outlined above using System Preferences > Users & Groups > Login Options. From Directory Utility, click “Edit” in the menu bar and you'll find the “Disable Root User” and “Change Root Password” commands.
Mac administrators can use the root user account to perform tasks that require access to more areas of the system. The user account named ”root” is a superuser with read and write privileges to more areas of the system, including files in other macOS user accounts. The root user is disabled by default.
The user named root, or superuser, is a special user account in UNIX-like operating systems that has unrestricted read and write privileges to all areas of the file system in OS X 10.10 or earlier. However, in OS X 10.11 or later, the root user's write access to certain areas of the file system is restricted.
It looks like the Authorization Services Programming Guide might help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With