Re: Allow only root/admin users to execute the cocoa app
Re: Allow only root/admin users to execute the cocoa app
- Subject: Re: Allow only root/admin users to execute the cocoa app
- From: Todd Heberlein <email@hidden>
- Date: Sun, 24 Jan 2010 13:31:05 -0800
> I want to allow my cocoa app to be only launched by root/admin users.
> How can i achieve this?
As I think has already been mentioned, the UNIX approach is to set the application's owner as root and then make it only executable by the owner. However, Apple largely discourages programmers from developing Cocoa apps that will be run with root privileges.
A better approach, if possible, is to factor out the section of code that needs to be run with root privilege (e.g., to read a protected file or open a network tap) and place that in a command line helper tool. The Cocoa app then runs with normal privileges. When the program needs to perform the privileged operation it calls that helper app (think of it as a kind of remote procedure call).
Look up Apple's BetterAuthorizationSample code for how to do this.
Todd
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden