Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Apr 2008 16:19:03 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Jille <jille@quis.cx>
Cc:        freebsd-current@freebsd.org
Subject:   Re: chmod of some pidfiles
Message-ID:  <20080416131902.GU18958@deviant.kiev.zoral.com.ua>
In-Reply-To: <4805FB23.4030600@quis.cx>
References:  <4805FB23.4030600@quis.cx>

next in thread | previous in thread | raw e-mail | index | archive | help

--juwRYO7N74otsfNI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Apr 16, 2008 at 03:12:03PM +0200, Jille wrote:
> Hello,
>=20
> Today I found out some pidfiles of 'system daemons', have a 'weird' chmod.
>=20
> [quis@istud ~]$ ls -l /var/run/cron.pid
> -rw-------  1 root  wheel  4 Mar  1 19:25 /var/run/cron.pid
>=20
> Can somebody tell me why it is 0600 ?
> I don't think it will harm if it is 0644 ?
>=20
> I think this is only useful if the security.bsd.see_other_uids sysctl is=
=20
> set to 0.

They are 0600 so that the advisory locking works reliably on them.
More details:
the daemons flock() the pidfile to indicate that it is alive. Any other
process may lock the file that can be opened for reading. Having more
permissive mode would allow anybody to lock the pidfile, falsely indicating
that the daemon is still alive, while it in fact died.

--juwRYO7N74otsfNI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (FreeBSD)

iEYEARECAAYFAkgF/MYACgkQC3+MBN1Mb4gEegCgl9sW/UZzq7h+fzCWdraoZ1Ua
OJEAoPe7oPWvj9UhavwwknRsmRKL4vUH
=ZXfD
-----END PGP SIGNATURE-----

--juwRYO7N74otsfNI--



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