non-root process and PID files
Miguel Mendez
flynn at energyhq.es.eu.org
Mon Oct 27 07:37:21 PST 2003
Dixitur illum "Dan Langille" <dan at langille.org> scribere...
Hi,
> 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
OpenBSD seems to favor this approach, if that tells you something.
[...]
-rw-r--r-- 1 root wheel 6 Oct 10 21:17 mountd.pid
-rw-r--r-- 1 root wheel 5 Oct 10 21:17 named.pid
-rw-r--r-- 1 root wheel 20 Oct 12 22:13 nmbd.pid
-rw-r--r-- 1 root wheel 5 Oct 10 21:17 ntpd.pid
-rw-r--r-- 1 root wheel 6 Oct 10 21:17 pflogd.pid
-rw-r--r-- 1 root wheel 5 Oct 11 10:15 rtadvd.pid
-rw-r--r-- 1 root wheel 20 Oct 12 22:13 smbd.pid
-rw-r--r-- 1 root wheel 6 Oct 10 21:17 sshd.pid
-rw-r--r-- 1 root wheel 6 Oct 10 21:17 syslog.pid
[...]
> Of the two, I think #1 is cleaner as it does not require another
> directory with special permissions.
Agreed.
Cheers,
----
Miguel Mendez
http://www.energyhq.es.eu.org
More information about the freebsd-hackers
mailing list