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

From: Artur Pydo - EuroBretagne <[email-masked]>
Date: Tue, 24 Jun 1997 16:10:08 +0200 (MET DST)

Hello,

I've checked everything and i can't find any explanation for this
problem...

I followed the instructions in Guest-Howto and i set up a guest access for
some users with the rights to rename,delete and overwrite files as shown
below :

/etc/ftpaccess :
...
delete          no      anonymous         # delete permission?
overwrite       no      anonymous         # overwrite permission?
rename          no      anonymous         # rename permission?
chmod           no      guest,anonymous         # chmod permission?
umask           no      guest,anonymous         # umask permission?
...

The directory of the user1 after login (chrooted) looks like that :

-r--------   1 root     root            0 Jun 24 13:32 .forward
-r--------   1 root     root            0 Jun 24 13:32 .rhosts
-rw-r--r--   1 user1    guest        5157 Jun 24 12:26 archie1.html
d--x--x--x   2 root     root          512 Jun 24 12:01 bin
d--x--x--x   2 root     root          512 Jun 24 12:05 etc

In this case user1 CAN delete the .forward and .rhosts files even
if they belong to root and if it should NOT happen.

I run wu-ftp BETA-13 on Sunos 4.1.4.

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: Michael Brennen <[email-masked]>
Date: Tue, 24 Jun 1997 10:09:33 -0500 (CDT)

I'll bet user1 owns the parent directory.  To delete a file, write
permission is needed to the parent directory, not the file itself. 

As delivered in the latest betas, leading dot files cannot be uploaded, so
no one can create a .* file (/etc/ftpaccess path-filter). 

One exception to be careful of is if you have the mv command installed for
site exec use; then someone could upload a file and rename it to a leading
dot file.

   -- Michael

---

From: Artur Pydo - EuroBretagne <[email-masked]>
Date: Tue, 24 Jun 1997 17:42:07 +0200 (MET DST)

Hello,

On Tue, 24 Jun 1997, Michael Brennen wrote:

> I'll bet user1 owns the parent directory.

Yes that's true.

> To delete a file, write permission is needed to the parent directory,
> not the file itself. 

It sounds strange to me. In Unix world, to delete a file you must be owner
of the file or must have write access on it.
In any case a user may delete a file owned by root with read-only access.

> site exec use; then someone could upload a file and rename it to a leading

That's right.

Cordialement,

Artur Pydo.

---

From: Jim Hribnak <[email-masked]>
Date: Tue, 24 Jun 1997 10:12:52 -0600 (MDT)

Yes that's true.

>It sounds strange to me. In Unix world, to delete a file you must beowner

> site exec use; then someone could upload a file and rename it to a leading
=========

on BSDI 2.1 you can use the chflags (man chflags) and make the files
undeletable by any user except the owner regardless of what the parent
diretory is set at..

I dont like users playing with .rhosts, .forward etc so when we create new
unix email accounts a .rhost and .forward are automatically created and
then I do the following:

chown root.wheel .forward ; chflags uchg .forward
chown root.wheel .rhosts ; chflags uchg .rhosts

this makes the file un changeable by anyone but ROOT (since he is the
owner) and also the super-user..

here is a little blurb from the man:

   uchg    set the user immutable flag (owner or super-user only)

you can change it back with a chflags nouchg <filename>  Make sure you
dont use schg the only way to remove that is in single user mode.

Jim

---

From: Michael Brennen <[email-masked]>
Date: Tue, 24 Jun 1997 11:13:44 -0500 (CDT)

Good point.  Linux has chattr to do effectively the same thing.

   -- Michael