What is the proper way to run something like $sudo touch folder_name or $sudo rm from within Objective-C/Cocoa? I’m changing and moving around a few files and need elevated privileges. Any code sample would be greatly appreciated. Thanks.
What is the proper way to run something like $sudo touch folder_name or $sudo
Share
One way to do it is
AuthorizationExecuteWithPrivileges(), but that’s discouraged for the normal course of things. Mainly it’s for installers, I gather.Something like:
And you add appropriate checking of
err…See the Authorization documentation.