Subject: Re: Guest setup : Overwrite .rhosts .forward files.

From: Artur Pydo - EuroBretagne <[email-masked]>
Date: Wed, 25 Jun 1997 09:30:10 +0200 (MET DST)

Hello,

On Tue, 24 Jun 1997, A. Rich wrote:

> 
> pydo> It sounds strange to me. In Unix world, to delete a file you must be
> pydo> owner of the file or must have write access on it.  In any case a user
> pydo> may delete a file owned by root with read-only access.
> 
> you can delete any file that resides in a directory you own.  you may not edit
> the file or read it, but you can delete it if you own the directory.

Well... If it is a normal behavior, i suggest to create two directories
named .forward and .rhosts and then to create a file in each of them. The
name of each file is of your choice. Set the permissions as for bin or etc
directories.
In this case, the user will be unable to remove the not empty directories.
If it seems to be a good solution, maybe it can be added to the FAQs or
HOWTOs.

Best regards,

Artur Pydo.

********************************************************************
* Eurobretagne               * http://www.eurobretagne.fr/         *
* 32, rue Mirabeau           * ftp://ftp.eurobretagne.fr/          *
* 29480 Le Relecq Kerhuon    * mailto:[email-masked]         *
* France                     * Home : http://www.mygale.org/~pydo/ *
* TEL : +33 (0)2 98 00 46 53 * FAX : +33 (0)2 98 30 52 10          *
********************************************************************

---

From: [email-masked] (William L. Sebok)
Date: Wed, 25 Jun 1997 11:49:29 -0400 (EDT)

I wrote: 

> The is an exception: on some Unix systems, such as SunOS 4.X and
> Solaris 2.X from Sun, if the sticky bit is set on the directory then
> a file in that directory can ownly be removed if the user owns the
> file, the user owns the directory, the file is writable by the user,
> or the user is a privileged user.

> From [email-masked] Tue Jun 24 18:12:02 1997
Jim Dennis <[email-masked]> replied

> 	The semantics of the sticky bit on the directory isn't 
> 	quite as you describe.
> 
> 	If a directory is 'chmod 1777' (for example) -- to set
> 	the sticky bit (NOT THE SGID/SUID bits) then files created
> 	in that directory can only be removed by their owner (or 
> 	root, of course).  Anyone with with write access to the file
> 	can truncate it or overwrite it -- but only the owner can 
> 	remove the link. 

I was essentially quoting from the chmod(3) man page for Solaris 2.5.  I
neglected to say that the directory must be already writeable or that root
could delete the file no matter what the permissions --- that I was assuming.
I said nothing about who could write to or truncate these files.

Here is the exact quote from the man page:

     If a directory is writable and has S_ISVTX (the sticky  bit)
     set,  files  within that directory can be removed or renamed
     only if one or more of the following is true (see  unlink(2)
     and rename(2)):

               o     the user owns the file

               o     the user owns the directory

               o     the file is writable by the user

               o     the user is a privileged user

> 	I'm no Unix historian but I think this feature was added
> 	to BSD variants first.  SunOS was BSD derived.

I'm not sure when it was added.  I know it was not there in BSD 4.2.  I think
(but could be wrong) that it came into SunOS between SunoS 3.X and 4.0. I never
had a change to try a pure BSD 4.3 system.

Bill Sebok      Computer Software Manager, Univ. of Maryland, Astronomy
	Internet: [email-masked]	URL: http://www.astro.umd.edu/~wls/