mod_ftpd Manual

Edward Rudd

Maintainer
Revision History
Revision 0.62007-01-25
Added documentation about Pasv Override parameters
Revision 0.52006-02-13
Converted to Simpliefied docbook 1.1
Revision 0.42005-01-30
Added documentation about FtpAllowOverwrite
Revision 0.32004-02-09
Added DBI documentation provided by Paul Querna
Revision 0.22004-01-08
Updated to reflect changes on mod_ftpd 0.12.0
Revision 0.12004-01-07
Initial Conversion from Text to Docbook

Table of Contents

Introduction
Copyright and License
Credits / Contributors
Feedback
Translations
Building and Installation
Sample Configuration
Configuration Directives
Main Module Directives
FTP Default provider
FTP Fail provider
FTP DBM provider
FTP DBI provider
Knwon issues and limitations
Contact Information

Introduction

This is a FTP Protocol Server module for Apache 2.0 and 2.1. It is based loosely on the mod_pop3 code base, so many thanks to the author of mod_pop3. This is still a developmental module, and directives and features may change without notice from release to release. There is a sample configuration provided at the end of this document.

Copyright and License

This document, mod_ftpd Manual, is Copyright© 2002 by Edward Rudd. Permission is granted to copy and distribute this document so long as it is included with the associated application, mod_ftpd, in source or binary form.

Credits / Contributors

In this document, I have the pleasure of acknowledging:

Feedback

Feedback is most certainly welcome for this document. Send your additions, comments and criticisms to the following email address : .

Translations

Currently I there are no translations of this document. However if you would like to translate this document into other languages please do so and submit them to this email address : .

Building and Installation

  1. ./configure --with-apxs=/path/to/apxs

  2. make

  3. su -c "make install"

Sample Configuration

Example 1. A sample Apaceh 2.0 configuration

LoadModule ftpd_module modules/mod_ftpd.so
# Load any of the provider modules here (for user specific chroots)
#LoadModule ftpd_dbm_module modules/mod_ftpd_dbm.so
#LoadModule ftpd_dbi_module modules/mod_ftpd_dbi.so
LoadModule ftpd_default_module modules/mod_ftpd_default.so
#LoadModule ftpd_fail_module modules/mod_ftpd_fail.so

Listen 21
<VirtualHost *:21>
        DocumentRoot /var/ftp
        FtpProtocol On
        FtpShowRealPermissions Off
        FtpAllowActive On
        FtpPasvMinPort 1024
        FtpPasvPaxPort 65535
        FtpLimitOrder default
        FtpDefaultMaxLogins 100
        <Directory /var/ftp>
                AuthUserFile /usr/local/httpd/ftp
                Anonymous_Authoritative On
                AuthAuthoritative Off
                Anonymous_NoUserID Off
                Anonymous_MustGiveEmail Off
                Anonymous_VerifyEmail Off
                Anonymous_LogEmail Off
                Anonymous anonymous
                AuthName ftp
                AuthType Basic
                require valid-user
                order allow,deny
                allow from all
        </Directory>
# only allow changing, retrieving files, and listing on the site
        <Location />
                <LimitExtept CHDIR GET LIST>
                        deny from all
                </LimitExcept>
        </Location>
# allow making directories, listing, chdir, and uploading files.
# But don't allow retrieving files.
        <Location /upload>
                <LimitExcept LIST PUT MKCOL CHDIR>
                        deny from all
                </LimitExcept>
                FtpAllowOverWrite Off
        </Location>
</VirtualHost>

Configuration Directives

Main Module Directives

FtpProtocol

Whether this server is serving the FTP protocol. The default is Off

FtpShowRealPermissions

Show Real Permissions of files? the default is Off. When Off files will show as mode 644, and directories as 755.

FtpFakeGroup

If FTPShowRealPermissions is OFf then this is the group name that is displayed in directory listings. The default is ftp.

FtpFakeUser

If FTPShowRealPermissions is OFf then this is the user name that is displayed in directory listings. The default is ftp.

FtpAllowActive

Allow active(PORT) data transfers from the server. The default is On.

FtpAllowFXP

Allow FXP transfer mode. That is to allow using two control connections to two different server and have them transfer files directly to each other. If this is off then data connections are only allowed to come from the client that has the control connection. The default is Off.

FtpPasvMinPort

Minimum PASV port to use for Data connections. The default value is 1024. This value must be less than FTPPasvMaxPort.

FtpPasvMaxPort

Maximum PASV port to use for Data connections. The default value is 65535. This value must be greater than FTPPasvMinPort.

FtpPasvOverrideAddr

Override the Passive source port (the ftp server) returned to the client with this IP. The default is to use the IP based on incoming connection.

FtpPasvOverrideAddrExclusion

CIDR formatted (ip/{mask or # of bits) netblock that will NOT be overriden when FtpPasvOverrideAddr is set. Example: 192.168.1.0/24

FtpChrootOrder

This is the chroot provider order to use for determining what chroot dir the user should be locked into. The providers are separate modules that must be loaded after mod_ftpd.so (dbm, dbi, default, and fail are included). The default is to do no chroot mapping. A value of none empties the chroot order list.

FtpLimitOrder

This is the limit provider order to use for determining when too many users are logged into the FTP server. Currently there is only the default provider. As with the Chroot providers, these are separate modules that must be loaded after mod_ftpd.so. The default is to do no limiting. A value of none empties the limit order list.

FtpServerAnnounce

Setting this to Off will prevent the mod_ftpd/VERSION tag from being added to the server header in Apache HTTP requests. This does not change the initial server response when a client connects via FTP to the server. The default value is On.

FtpAllowOverwrite

Setting this to On will prevent an ftp client from overwriting an existing file. In order for the file to be replaced, it must be deleted from the server first (DELETE method rights). This is good for an upload only directory where you do not want users overwriting existing files. The default value is On.

<Limit>, <LimitExcept> methods

To limit what users can and cannot do in directories the Limit and LimitExcept must be used.

CHDIR

ability to change into this directory (required for login)

GET

ability to download a file

LIST

ability to get a directory listing

PUT

ability to upload a file

APPEND

ability to append to an existing file (either APPE, or STOR with REST)

DELETE

ability to delete a file

MKCOL

ability to make a directory

XRMD

ability to delete a directory

MOVE

ability to move files or directories

FTP Default provider

LoadModule ftpd_default_module modules/mod_ftpd_default.so

This module is useful to provide a fail-back chroot path if other modules do not provide one for the user attempting to login.

FtpDefaultChroot

This is the path that this module will return as the chroot.. It will ALWAYS return this path and no other. The default is empty, and the server will use the DocumentRoot as the chroot.

FtpDefaultMaxLogins

This is the maximum number of logins to allow when this module is listed in the FtpLimitOrder directive. The default is 20, and the value must be greater than zero.

FTP Fail provider

LoadModule ftpd_fail_module modules/mod_ftpd_fail.so

There is no configuration for this module.. Just add it to FtpChrootOrder and any user that hits this module will immediately fail and not be allowed to login. Use this in a chain of modules and this as a fail-back to deny logins if they do not have a chroot assigned.

FTP DBM provider

LoadModule ftpd_dbm_module modules/mod_ftpd_dbm.so

FtpDBMFile

The filename of the database to use. Can be absolute or relative to the server root.

FtpDBMType

The type of Database the file is (default,DB,GDBM,NDBM,SDBM)

FTP DBI provider

LoadModule ftpd_dbi_module modules/mod_ftpd_dbi.so

FtpDbiDriver

Database Driver to use from libdbi

FtpDbiDriverDir

Directory containing the libdbi database drivers. The default value is from set at compile time

FtpDbiHost

Hostname of the Database Server to connect to

FtpDbiUsername

The username for the database connection

FtpDbiPassword

The password for the database connection

FtpDbiName

The name of the database containing the tables

FtpDbiTable

The name of the table containing the usernames and password hashes

FtpDbiUsernameField

The table field that contains the username

FtpDbiChrootField

The table field that contains the password

FtpDbiChrootQuery

The SQL query to pick the chroot value from

FtpDbiIsActiveField

The table field that contains the active account flag

FtpDbiConnMin

The Minimum Number of Database Connections

FtpDbiConnSoftMax

The Soft Maximum Number of Database Connections

FtpDbiConnHardMax

The Hard Maximum Number of Database Connections

FtpDbiConnTTL

The Database Pool Time To Live for Each Connection

FtpDbiServerConfig

The name of the configuration to use for this section

Knwon issues and limitations

These are some of the known issues and limitations of the module. Also check the TODO file for any issues that did not make their way into this document. And of course, if you feel the urge to actually implement something on my TODO list feel free to submit a unified diff patch to the following email address : .

  • This module has been build using Apache 2.0.48. I have had people test it on 2.0.47 and 2.1 CVS HEAD.. But I have not officially tested it on 2.1 yet. When an official release of 2.1 is out, then I will test and modify my module for this branch of Apache.

  • Transferred files do NOT currently go through apache filters and bucket brigades.. When I figure them out, I will support that feature.. (dynamic FTP content..)

  • I have not load tested this at all.. So I do not know how well it will stand up to stress testing. Can some people run dkftpbench on this thing?

  • The code has not been thoroughly tested for security related issues.. However, the code is relatively simple, and all ACL checks go through one function, which passes everything to Apache. The source is also available and can be audited by anyone who wishes to.

  • I do not support the ABOR command, currently, nor do I check for the Telnet command sequences.. Can someone give me an example client that uses these?

  • There is code in there for unfinished features, just ignore it.. It will be either finished or removed in future releases.

  • There are no timeouts of any sort currently.. I am trying to find a portable way of doing it, however the apr_poll functions seem to be of no use as I can not get access to the connection socket.

  • content providers SHOULD check FTP_PLUGIN_VERSION and if it is not the same bailout and refuse to compile as the API is going to be different.

  • I need to write documentation on the provider interface. However, the header file mod_ftpd.h is quite self documented.

Contact Information

You can contact me via the following mediums.

Please use a meaningful subject line for e-mail, otherwise your e-mail may be silently deposited in my junk mail folder by my SPAM filters and possibly never seen by me. Use something like "mod_ftpd patch to implement feature X" would be quite acceptable, however, "PLEASE READ THIS NOW" is quite unacceptable and will most likely never be read.