Subject: Re: clearing suid/sgid bits upon ownership change
To: Jim Wise <jimw@numenor.turner.com>
From: Rob Windsor <windsor@warthog.com>
List: tech-kern
Date: 12/10/1997 14:30:26
Verily did Jim Wise write:

> -----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':

Try it as root (as I had clarified in my e-mail this morning).

> 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.

But, again, not as root.

-- Rob
----------------------------------------
Internet: windsor@warthog.com
Life: Rob@Carrollton.Texas.USA.Earth

The weather is here, wish you were beautiful.