Re: Executing shell script with root privilege
Re: Executing shell script with root privilege
- Subject: Re: Executing shell script with root privilege
- From: Steven Degutis <email@hidden>
- Date: Mon, 15 Feb 2010 10:31:47 -0500
Essentially you need to use the Security.framework API which you were
already using in the beginning. You're already heading in the right
direction. If you continue to read the docs on it, you'll get your sample
code working; they're pretty thorough docs I believe.
-Steven
On Mon, Feb 15, 2010 at 1:48 AM, cocoa learner <email@hidden>wrote:
> 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
>
--
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
_______________________________________________
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