Re: NSTask and Shell
Re: NSTask and Shell
- Subject: Re: NSTask and Shell
- From: Nick Zitzmann <email@hidden>
- Date: Sun, 2 Mar 2003 14:36:37 -0800
On Sunday, March 2, 2003, at 01:47 AM, Martin Weil wrote:
I am trying to execute a sudo command via NSTask, all works well, but
I don't know how to transmit the password to the shell, after I
transmitted the sudo command and the shell gives me the Password
prompt.
Ah, and a second question: I am searching for a special Panel to
retrieve an admin password from the user. I often see the same panel
for this in many apps (e.g. Software-Update), so there must be some
sort of special panel for this.
For both of these, you ought to use the Security framework and not
NSTask. There's sample code available on the ADC Web site that shows
you how to set up an AuthorizationRef and then use it to run a command
with super-user privileges.
If you really want to use sudo and NSTask anyway, and your product is
going to use the GPL license, you might want to see the source code for
Monolingual: <
http://homepage.mac.com/jschrier/monolingual_source.tgz>
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://dreamless.home.attbi.com/
if (message.signature==FUNNY) steal(message.signature); else
message=message->next;
_______________________________________________
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.