Re: Executing shell script with root privilege
Re: Executing shell script with root privilege
- Subject: Re: Executing shell script with root privilege
- From: cocoa learner <email@hidden>
- Date: Mon, 15 Feb 2010 12:18:18 +0530
Ok let me put my problem in simple words -
I have a cocoa app and I want to launch a shell script which has to do some
task with root privilege. How can I do it???
Regards,
Cocoa.learner
On Mon, Feb 15, 2010 at 1:49 AM, Nick Zitzmann <email@hidden> wrote:
>
> On Feb 13, 2010, at 11:05 PM, cocoa learner wrote:
>
> > And permission of this script is -
> > -rwx------ 1 root wheel 536 Feb 14 10:51 /Users/test/myScript
> >
> >
> > When I am executing the app "launchScript" is returning me TRUE but my
> > script is not getting executed. I am totally lost, have no clue why it's
> > happening like this.
> >
> > Does any body know why this script is not getting executed? Am I doing
> any
> > thing wrong?
>
> Yes and yes. You set your script's permissions to 700 root/wheel, which
> means that you don't have permission to run the script. AEWP() executes
> tasks with root privileges, but it doesn't execute them _as_ root. If you
> need to do that, then you must use a wrapper that sets the uid to root.
> Check the archives for more information. It might be easier, though, to set
> the permissions to 755 instead, and put in a check for root privileges.
>
> And if that still doesn't work, then you might need to execute the shell as
> the task, and point the shell to the script, but I'm pretty sure you just
> have the permissions set incorrectly.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
>
>
>
_______________________________________________
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