Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Oct 2003 16:36:58 +0100
From:      Miguel Mendez <flynn@energyhq.es.eu.org>
To:        "Dan Langille" <dan@langille.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: non-root process and PID files
Message-ID:  <20031027163658.5d5af160.flynn@energyhq.es.eu.org>
In-Reply-To: <3F9CF3F6.8307.ABC1250@localhost>
References:  <3F9CF3F6.8307.ABC1250@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
Dixitur illum "Dan Langille" <dan@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031027163658.5d5af160.flynn>