Re: Run Bash script as root
Re: Run Bash script as root
- Subject: Re: Run Bash script as root
- From: Tom Harrington <email@hidden>
- Date: Wed, 10 Aug 2005 15:51:52 -0600
On 8/10/05, Jerry Brace <email@hidden> wrote:
> I'm trying to run a bash script as root - I am prompting for
> authentication - all of that works great. When it comes time to run
> the script it doesn't seem to do anything (not writing out the echo
> text I have in the script). Even if I put in an invalid name for the
> resource (wakeup.sh) it doesn't throw an error and still prompts
> correctly for the password. Any help would be great!
>
> NSBundle *thisBundle = [NSBundle bundleForClass:[self class]];
> NSMutableString * path = [thisBundle pathForResource:@"wakeup"
> ofType:@"sh"];
...
> err = AuthorizationExecuteWithPrivileges(authorizationRef,
> [path cString],
> myFlags, NULL,
> &myCommunicationsPipe);
You don't ever seem to be checking the value of path. Most likely
it's nil, and you need to debug your NSBundle lookup.
And please don't use -cString; use -UTF8String, or even better,
-fileSystemRepresentation.
--
Tom Harrington
email@hidden
AIM: atomicbird1
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden