On Monday 27 October 2003 07:31 am, Dan Langille wrote:
> If a process starts up and does a setuid, should it be writing the
> PID file before or after the setuid?
>
> Two methods exists AFAIK:
>
> 1 - write your PID immediately, and the file is chown root:wheel
> 2 - write your PID to /var/run/myapp/myapp.pid where /var/run/myapp/
>     is chown myapp:myapp
>
> Of the two, I think #1 is cleaner as it does not require another
> directory with special permissions.
>
> Any suggestions?

Create the pid file while still root, and if you are going to change the 
user or group id, chown(2) or chgrp(2) the file just before setuid(2) / 
setgid(2) calls.

-- 

        Where am I, and what am I doing in this handbasket?

Wes Peters                                               [EMAIL PROTECTED]

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to