Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems running a shell script as root



Hi

I am using AuthorizationExecuteWithPrivileges to run a shell script which needs root privileges. I can execute the shell scripts as a local user, but can't  run scripts which need root privileges.
I read through many doc's on the net and the guides in developer.apple.com since yesterday, and haven't found an answer yet.

Please advice.

-------------  the code --------------------------
AuthorizationRef authRef_;
NSString *pathToTool = @"/bin/sh";
NSString *filePath3 = @"~/Desktop/AUTOscript/loadApp.sh";

  argsArray3[0] = "-p";
  argsArray3[1] = (char *)[[filePath3 stringByExpandingTildeInPath] fileSystemRepresentation];
  argsArray3[2] = NULL;

OSStatus status3 = AuthorizationExecuteWithPrivileges(authRef_, [pathToTool UTF8String], 0, argsArray3 , NULL);

// no flags or pipes here.
-------------------------------------------------------

Thank you
DG 
       
---------------------------------
 5, 50, 500, 5000. Store N number of mails in your inbox. Click here.
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.