Subject: Re: UFS chmod weirdness
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Christian Kuhtz <kuhtz@ix.netcom.com>
List: current-users
Date: 12/22/1996 00:21:21
On Sat, 21 Dec 1996 17:44:02 -0500 (EST), der Mouse   
<mouse@Rodents.Montreal.QC.CA> wrote:
> This appears to be intended to prevent non-root from setting sticky
> bits (except on directories).  However, it has the side effect that
> given a file owned by non-root with its sticky bit set, then even its
> owner cannot chmod that file without (irrevocably) clearing the sticky
> bit.
>
> Is it supposed to work this way?  It produces some very odd-looking
> failure messages from chmod(1).

Hmm, sticky(8) says the following about directories.  I assume your comments  
was more pointed at directories than at files, and in general the behavior is  
not much different anyway.

STICKY DIRECTORIES
     A directory whose `sticky bit' is set becomes an append-only
     directory, or, more accurately, a directory in which the
     deletion of files is restricted.  A file in a sticky direc-
     tory may only be removed or renamed by a user if the user
     has write permission for the directory and the user is the
     owner of the file, the owner of the directory, or the
     super-user.  This feature is usefully applied to directories
     such as /tmp which must be publicly writable but should deny
     users the license to arbitrarily delete or rename each oth-
     ers' files.

     Any user may create a sticky directory.  See chmod(1) for
     details about modifying file modes.

In other words, irrevocably clearing your own sticky bit is not correct,  
because anyone should be able to create sticky bits at will.  Assuming your  
interpretation of the code is correct and I didn't misunderstand you, I would  
concur with this not being desired behavior. 8-]

Btw: sticky bits make for a wonderful denial of service attack. ;-)

BUGS
     Since the text areas of sticky text executables are stashed
     in the swap area, abuse of the feature can cause a system to
     run out of swap.

Anyhow, my $.02 on a Sunday morning,
Chris

--
Christian Kuhtz <ckuhtz@paranet.com>                      kuhtz@ix.netcom.com
Paranet, Inc.
http://www.paranet.com/         BOYCOTT INTERNET SPAM http://www.vix.com/spam