Subject: wu-ftpd 2.4, Sun Solaris 2.3, and passive mode ftp connections

From: "Nelson H. F. Beebe" <[email-masked]>
Date: Wed, 08 Mar 1995 16:44:29 -0700

Recently, one of our users reported that OmniWeb, a World-Wide Web
client on the NeXT workstation, was unable to make a connection to the
ftp site that I maintain (ftp.math.utah.edu).

Correspondence with the OmniWeb author produced this response:

>> ...
>> From: William Shipley <[email-masked]>
>> To: Multiple recipients of list <[email-masked]>
>> Subject: Re: ftp cannot open passive connection
>> X-Listprocessor-Version: 6.0 -- ListProcessor by Anastasios
>> Kotsikonas
>> X-Comment: OmniWeb Discussion
>> X-Organization: Omni Development, Inc.
>> Content-Type: text/plain Status: RO
>>
>> > Reason: FTP-server replies Can't open passive connection:
>> > Permission denied.
>>
>> Right now, OmniWeb insists on always opening a passive
>> connection, as apparently some types of firewalls insist on
>> this.  We really ought to have it settable.
>>
>> In the meantime, you might be able to set up your ftp server
>> so it accepts passive connections.
>>
>> -Wil
>>
>> ...

I built a version of wu-ftpd 2.4 on ftp.math.utah.edu with debug
symbols enabled, and tracked down the problem with failure of passive
mode connections.

A debug session showed that when passive() in ftpd.c was entered, the
code

    pdata = socket(AF_INET, SOCK_STREAM, 0);
    if (pdata < 0) {
        perror_reply(425, "Can't open passive connection");
        return;
    }

got pdata = -1 on return, which resulted in the passive connection
being refused.  Examination of errno showed that it was set to 13
(EACCESS). We checked the protections of the directory ~ftp/dev, and
compared with those of /dev.  That was the problem: on Sun Solaris 2.3,
/dev has these files needed by ftpd:

crw-rw-rw-   1 root     sys       11, 42 Aug 22  1994 /dev/tcp
crw-rw-rw-   1 root     sys       11,  9 Aug 22  1994 /dev/ticotsord
crw-rw-rw-   1 root     sys       11, 41 Aug 22  1994 /dev/udp
crw-rw-rw-   1 root     sys       13, 12 Aug 22  1994 /dev/zero

while ~ftp/dev had

crw-rw-r--   1 root     other     11, 42 Aug 30  1994 tcp
crw-rw-r--   1 root     other     11,  9 Aug 30  1994 ticotsord
crw-rw-r--   1 root     other     11, 41 Aug 30  1994 udp
crw-rw-r--   1 root     other     13, 12 Aug 30  1994 zero

Notice that these are lacking world write access.  Once we did a
"chmod a+w ~ftp/dev/*", the problem was fixed, and passive mode
connections to ftp services on ftp.math.utah.edu are now available:

% ftp ftp.math.utah.edu
...
ftp>quote pasv
227 Entering Passive Mode (128,110,198,34,207,218)

I don't know why our ~ftp/dev files were missing world write access,
but perhaps this message will spur readers of this list to check that
passive mode is permitted by their ftpd instalations.

========================================================================
Nelson H. F. Beebe                      Tel: +1 801 581 5254
Center for Scientific Computing         FAX: +1 801 581 4148
Department of Mathematics, 105 JWB      Internet: [email-masked]
University of Utah
Salt Lake City, UT 84112, USA
========================================================================