Subject: Re: clearing suid/sgid bits upon ownership change
To: Rob Windsor <windsor@warthog.com>
From: Jim Wise <jimw@numenor.turner.com>
List: tech-kern
Date: 12/10/1997 11:58:44
-----BEGIN PGP SIGNED MESSAGE-----

On Tue, 9 Dec 1997, Rob Windsor wrote:

> securelevel >1. I can't stand this behavior.  No other modern un*x in the
> world does this insane crap.  I just love `surprises' like this in NetBSD --
> not.

- From the XSI5 (Unix 98) Standard:

	If the path argument refers to a regular file, the set-user-ID
	(S_ISUID) and set-group-ID (S_ISGID) bits of the file mode are
	cleared upon successful return from chown(), unless the call is
	made by a process with appropriate privileges, in which case it
	is implementation-dependent whether these bits are altered. 

It is also not true that ` No other modern un*x in the world does this':

Solaris 2.6:

$ touch foo
$ ls -l foo
- -rw-r--r--   1 jim      users          0 Dec 10 11:58 foo
$ chmod 6555 foo
$ ls -l foo
- -r-sr-sr-x   1 jim      users          0 Dec 10 11:58 foo
$ chgrp src foo
$ ls -l foo
- -r-xr-xr-x   1 jim      src            0 Dec 10 11:58 foo

Irix 6.2

$ touch foo
$ ls -l foo
- -rw-r--r--    1 jimw     graphics       0 Dec 10 11:54 foo
$ chmod 6555 foo
$ ls -l foo     
- -r-sr-sr-x    1 jimw     graphics       0 Dec 10 11:54 foo
$ chgrp wits foo
$ ls -l foo
- -r-xr-xr-x    1 jimw     wits           0 Dec 10 11:54 foo

So, this feature may or may not be a good idea, (I like it myself), but
it _is_ standard, and it _is_ widely implemented.

- --
				Jim Wise
				jim.wise@turner.com

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Charset: noconv

iQEVAwUBNI7KShg+dMhCouwfAQESmgf/bLaxMrkHUDQRJblIB+JAtMfwVHnoAcZS
C/tT7iyZHDbc64mtYm143Iq7FPwbcxzTqdKcXdfjpdItAob0zObczfieIuCQZTfF
UmPPqbVyQ6fkVPfWwVgRyyjGHH4JhiIx3/iIJF33vyGXVWKpvlm0yW6aybwPWkKG
dkmxnQk2yG177l0tJ2seOPTIkkZXvaydPysbmp7AMF8dFATa8AJ0elk56HwJLaUU
9RzY+KtG7yPo30vFLPT4Kr1J+JxaoKOnVMnKaKdxrWjrNTyBoUs69GhYhOK3jzNj
QpWwR6pAjTULQEsjlqGpG7oSD0Ju7OgLOdFAyw6gOc9CijP5BBcLog==
=8wPb
-----END PGP SIGNATURE-----