Re: nstask with admin privs
Re: nstask with admin privs
- Subject: Re: nstask with admin privs
- From: Michael Watson <email@hidden>
- Date: Fri, 12 Jan 2007 15:43:42 -0500
Something about your approach seems quite off. I can tell you that
I've launched helper tools with privilege via
AuthorizationExecuteWithPrivileges() and logged their UID as 0,
without additional hackery. Is this not what you're after?
--
m-s
On 12 Jan, 2007, at 15:37, Andrew Satori wrote:
There is a wrinkle here though.
When you call shell task using the articles below, you do have
admin rights, but not "root". This may or may not be a problem,
for me it was, since I was calling something that checked for Root
and would exit if it was not root, so even though I had sufficient
rights, I didn't have 'root'. You can hack around this though.
What I did was assembled a little helper tool, that I run with
Admin privileges, that takes the command I want to execute on an
argument on the command line, and then escalates itself to correct
privs ala:
// main.c
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main (int argc, const char * argv[]) {
// insert code here...
// printf("Calling the StartupItem %s with parameter %s.\n",
argv[1], argv[2]);
setuid(0);
char* szCommand = (char *)malloc(strlen(argv[1]) + strlen(argv[2]
+ 2));
int x = 0;
for (x = 1; x < argc; x++)
{
sprintf(szCommand, "%s %s", szCommand, argv[x]);
}
// printf("%s\n", szCommand);
system(szCommand);
free(szCommand);
return 0;
}
and called that using the below articles.
Andy
On Jan 12, 2007, at 12:19 PM, Michael Watson wrote:
You won't use NSTask, but this can be done:
http://developer.apple.com/documentation/Security/Conceptual/
Security_Overview/index.html
http://developer.apple.com/documentation/Security/Conceptual/
authorization_concepts/index.html
--
m-s
On 12 Jan, 2007, at 11:51, Ian Archer wrote:
Is it possible to run a subtask through something like NSTask with
admin/sudo priviledges?
Ideally I'm looking for something which prompts the user for a
password before launching a secure subprocess. I don't want the
main
application to have to be run by admin, though.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40bungie.org
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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