Re: Run a process as root (asking only one time the root password)
Re: Run a process as root (asking only one time the root password)
- Subject: Re: Run a process as root (asking only one time the root password)
- From: "Daniel T. Staal" <email@hidden>
- Date: Thu, 21 Jun 2007 11:07:47 -0400 (EDT)
- Importance: Normal
On Thu, June 21, 2007 10:57 am, Hell's KItchen Hell's KItchen said:
> Hello guys,
> I need to execute a command-line process as root. I've tried using
> NSTask and BLAuthentication class (Security Framework). Everything
> works fine but each new start of the program will require again that
> password.
Is that a major problem? I normally prefer to know when something's about
to run as root...
> So my question... is possible to authenticate only one time
> the app and mantain that privileges between multiple sessions?
> I've discovered some infos about setuid. Is it the right solution? How
> can I use it?
> Thanks a lot for replies.
You can _install_ the command-line program as setuid root, and it will
work the way you want: Any time that program is run it will behave as if
root ran it.
In general I hope you are thinking _very_ carefully about what you are
doing here: Running as root is _not_ recommended, and _automatically_
running as root is recommended even less. Be absolutely sure it _needs_
be be run this way before you do it.
Daniel T. Staal
---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
_______________________________________________
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