On Thursday, January 16, 2003, at 04:07 AM, Rich Morin wrote:
Actually, Apple can't. It's a Unix thing... Startup scripts -- i.e. daemons and their spawn... sorry about that:) -- are children of init, process 1 and therefore ARE root. If a given script or daemon wishes to run as other than root it either must do as others have described -- change to some other UID on the fly, or NOT be started by the init process.After quite a bit of poking around, I ran across pp. 38-41 of "Mac OS X for Unix Geeks" (Jepson & Rothman, O'Reilly), which gives some explicit information on setting up Startup scripts. With this assistance, I was able to get my startup script going (whew!).I then noticed that the script (and any daemons it might start up) was running as root. Ungood. I worked around the problem by setting the script "setuid nobody", but this is not a really robust solution. I also filed a bug, suggesting that Apple add a startup parameter (e.g., RunAs) that would set the username; the default should be nobody.
This is all part and parcel of how Unix (ie the kernel) works.
If you want something to run as another id from "the begining" use cron or at.
OS X for Unix Geeks is the only thing other than the developer documentation. And that new O'Reilly book is the clearest explanation.P.S. Is there any other documentation to recommend on Startup scripts?
T.T.F.N.
William H. Magill
# Beige G3 - Rev A motherboard - 768 Meg
# Flat-panel iMac (2.1) 800MHz - Super Drive - 768 Meg
# PWS433a [Alpha 21164 Rev 7.2 (EV56)- 64 Meg]- Tru64 5.1a
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]