Subject: Permissions/modes question

From: Mike Batchelor <[email-masked]>
Date: Mon, 20 May 1996 08:25:01 -0400 (EDT)

I have the logdaemon ftpd, which automatically makes anon incoming files
mode 0044, owner ftp, group daemon, or whatever user/group is defined for
anon logins.  Obviously, this has some advantages in preventing an anon ftp
server from being used to pirate software, etc., since the anon login can't
read files it has uploaded, or directories it has created (but everyone else
can).

I can't seem to get this same behavior for the wu-ftpd 2.4, however.  When I
try, it creates the file, but then it's unable to write data to it and the
upload fails with a 0 byte file left behind.

Any tips?

-- 
  + + +      %%%%% Mike Batchelor % [email-masked] %%%%% A Division
 Capitol.Net %%%%%%%%%%% 301-306-9090 % V.34/ISDN %%%%%%%%%%%    of
     + + +   %% Serving Washington DC, No.VA, and Maryland %%   Criticom, Inc.

---

From: Yanming PENG <[email-masked]>
Date: Mon, 20 May 96 23:37:39 METDST

> upload fails with a 0 byte file left behind.
You probably use NFS, I guess. If so, check the NFS server export file,
give your ftp server root access.

--
Dr. Yanming PENG | [email-masked] http://peng.mech.kuleuven.ac.be |
Tel.32-16-322516 | The trouble with doing something right the first time is |
Fax:32-16-322987 | that nobody appreciates how difficult it was.            |

---

From: Mike Batchelor <[email-masked]>
Date: Tue, 21 May 1996 08:32:47 -0400 (EDT)

> give your ftp server root access.

That is correct, NFS is used and the /home/ftp directory is exported with no
root access, just like all the other /home dirs.  What I don't understand is
why the logdaemon ftpd can do this under the same circumstances, and wu-ftpd
cannot.

---

From: Yanming PENG <[email-masked]>
Date: Tue, 21 May 96 16:14:20 METDST

> why the logdaemon ftpd can do this under the same circumstances, and wu-ftpd
This is because ftpd allways does a "fchown". Even the file/dir owner/group
is the same as the ftp user. I did a little hack to ignore the error
returned by fchown to allow the ftpd run correctly without the root access
on the NFS file server. The logdaemon ftpd probably does the same or does not
do fchown.

---

From: [email-masked] (Koos van den Hout _U nix and we all_)
Date: Tue, 21 May 1996 16:56:39 +0200 (MET DST)

> why the logdaemon ftpd can do this under the same circumstances, and wu-ftpd

wu-ftpd tries to change the ownership of the uploaded file (in order to
avoid misuse of the upload dir). Changing the ownership of a file is a
'root' action.

                                                Grtx. KH

-- 
  Koos van den Hout,     Internetter, Unix freak, ISFJ and BBS SysOp at large
  [email-masked] (Home)        BBS Koos z'n Doos (+31-30-6036637 28k8)
  [email-masked] (Work)  <-- finger -l for PGPkey    (+31-30-6056619 14k4)
  http://www.hvu.nl/~koos (WWW)    Looking for a license plate with "RFC 822"
  Quando Omni Flunkis Moritati (If all else fails - play dead)     KH106-RIPE

---

From: Mike Batchelor <[email-masked]>
Date: Tue, 21 May 1996 15:41:14 -0400 (EDT)

> on the NFS file server. The logdaemon ftpd probably does the same or does not

You're right, logdaemon ftpd doesn't do fchown.  For anonymous logins, it
does this at the end of the login code:

        if (guest)
                defumask |= 0700;
        (void) umask(defumask);
        return;

And of course, ftp is the user who owns the files, but they are mode 0066,
so the ftp user can't read files it has uploaded, but everyone else can.