Re: [NOT NEWBIE]launching tasks as root
Re: [NOT NEWBIE]launching tasks as root
- Subject: Re: [NOT NEWBIE]launching tasks as root
- From: Sherm Pendley <email@hidden>
- Date: Tue, 1 Oct 2002 20:16:30 -0400
On Tuesday, October 1, 2002, at 07:11 PM, Charles Srstka wrote:
When I launch a task with AuthorizationExecuteWithPrivileges(), the
actual UID of that task is the same as the currently logged-in user,
but the effective UID is root. Unfortunately, the vsdbutil tool
requires the actual UID be root. Is there any way I can launch a task
with an actual UID of root without resorting to using sudo?
According to the setuid() man page, "The setuid() function sets the real
and effective user IDs and the saved set-user-ID of the current process
to the specified value. The setuid() function is permitted if the
effective user ID is that of the super user, or if the specified user ID
is the same as the effective user ID."
So, the following should do the trick:
setuid(geteuid());
Of course, that man page may be among those that describe BSD functions
that are not present in OS X. I've run across those before, and I find
them quite annoying; what's the point of including man pages for
functions that are MIA?
sherm--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.