FTPD(8) BSD System Manager's Manual FTPD(8)NAMEftpd - Internet File Transfer Protocol server
SYNOPSISftpd [-dDV] [-a address] [-c cachename] [-C cacheprio] [-f configfile]
[-p file] [-P port]
DESCRIPTION
Ftpd is the Internet File Transfer Protocol server process. The server
uses the TCP protocol and listens at the port specified in the ``ftp''
service specification; see services(5). Ftpd supports both Internet Pro-
tocol versions 4 and 6.
Available options:
-a When -D is specified, accept connections only on the specified
address.
-c Install entries into the circuit cache (see ipfw and
ipfwcircuit(8)) named cachename for passive connections. If the
circuit cache does not already exist then it will be created (in
this case see -C and -n below). This feature is useful when the
machine that is running ftpd also has an input filter installed
that would normally not allow the incoming passive requests. By
installing entries into the circuit cache ftp is able to "punch a
hole" through the packet filters to allow the incoming request.
This does not allow third party transfers, that is, the entry re-
quires the request come from the same address as the control con-
nection and go to the same address they originally connected to.
WARNING: you should never utilize this feature if you do not have
an input filter already installed. Doing so will result in turn-
ing off all incoming traffic! Further, using this feature, in
general, prevents the normal input filter from seeing packets for
the passive session.
-C Specify the priority for the circuit cache (defaults to 1024).
This priority must be higher than the normal input filter.
-d Debugging information is written to the syslog using LOG_FTP. If
the Debug flag is specified in the configuration file (see
ftpconfig(5)), it will override the -d option.
-D With this option set, ftpd will detach and become a daemon, ac-
cepting connections on the FTP port and forking children process-
es to handle them. This is lower overhead than starting ftpd from
inetd(8) and is thus useful on busy servers to reduce load. Fur-
ther, when running as a daemon, ftpd is able to restrict the num-
ber of users per virtual host. This feature (see ftpconfig(5))
is not available when running from inetd(8).
-f Use configfile instead of the standard configuration file
/etc/ftpd/config.
-n Specify the size of the hash table used for the circuit cache.
This defaults to 997 which should be sufficient for most situa-
tions (up to 10,000 simultaneous passive data sessions). The
hash algorithm works better when this is a prime number.
-p When -D is specified, write the daemon's process ID to file.
-P When -D is specified, accept connections on port port, instead of
the normal FTP port.
-V Verify the configuration file. In this case, ftpd does not ac-
cept any connections, it simply parses the configuration file and
reports any errors found.
The file /etc/nologin can be used to disable ftp access. If the file ex-
ists, ftpd displays it and exits. If a WelcomeMessage file has been
specified (see ftpconfig(5)) and exists, ftpd prints it before issuing
the ``ready'' message. If a LoginMessage file has been specified (see
ftpconfig(5)) and exists, ftpd prints it after a successful login.
The ftp server currently supports the following ftp requests. The case
of the requests is ignored.
Request Description
ABOR abort previous command
ACCT specify account (ignored)
ALLO allocate storage (vacuously)
APPE append to a file
CDUP change to parent of current working directory
CWD change working directory
DELE delete a file
HELP give help information
LIST give list files in a directory (``ls -lgA'')
MKD make a directory
MDTM show last modification time of file
MODE specify data transfer mode
NLST give name list of files in directory
NOOP do nothing
PASS specify password
PASV prepare for server-to-server transfer
PORT specify data connection port
PWD print the current working directory
QUIT terminate session
REST restart incomplete transfer
RETR retrieve a file
RMD remove a directory
RNFR specify rename-from file name
RNTO specify rename-to file name
SITE non-standard commands (see next section)
SIZE return size of file
STAT return status of server
STOR store a file
STOU store a file with a unique name
STRU specify data transfer structure
SYST show operating system type of server system
TYPE specify data transfer type
USER specify user name
XCUP change to parent of current working directory
(deprecated)
XCWD change working directory (deprecated)
XMKD make a directory (deprecated)
XPWD print the current working directory (deprecated)
XRMD remove a directory (deprecated)
The following non-standard or UNIX specific commands are supported by the
SITE request.
Request Description
UMASK change umask, e.g. ``SITE UMASK 002''
IDLE set idle-timer, e.g. ``SITE IDLE 60''
CHMOD change mode of a file, e.g. ``SITE CHMOD 755 filename''
GROUP request special group access. E.g. ``SITE GROUP foo''
GPASS give special group access password. E.g. ``SITE GPASS
bar''
HELP give help information
The remaining ftp requests specified in Internet RFC 959 are recognized,
but not implemented. MDTM and SIZE are not specified in RFC 959, but
will appear in the next updated FTP RFC.
The ftp server will abort an active file transfer only when the ABOR com-
mand is preceded by a Telnet "Interrupt Process" (IP) signal and a Telnet
"Synch" signal in the command Telnet stream, as described in Internet RFC
959. If a STAT command is received during a data transfer, preceded by a
Telnet IP and Synch, transfer status will be returned.
Ftpd interprets file names according to the ``globbing'' conventions used
by csh(1). This allows users to utilize the metacharacters ``*?[]{}~''.
Ftpd authenticates users by using the service and type of ftp, as defined
in the /etc/login.conf file (see login.conf(5)). An authentication style
may be specified by appending with a colon ( ``:'') following the authen-
tication style, i.e. ``joe:skey''.
Further, the following rules must also be passed:
1. The login name must be in the password data base and not have a null
password.
2. The login name, or a group the login name is a member of, must not
appear in the BannedUserList file, and if the PermitUserList file
has been defined and exists, the login name or a group it is a mem-
ber of must be listed in that file. Entries in these files inter-
preted as group names are prefixed by an "at" `@' sign.
3. The user must have a standard shell returned by getusershell(3).
4. If the user name appears in the ChrootUserList file, or the user is
a member of a group with a group entry in this file, i.e. one pre-
fixed with `@', the session's root will be changed to the user's lo-
gin directory by chroot(2) as for an ``anonymous'' or ``ftp'' ac-
count (see next item). This facility may also be triggered by en-
abling the boolean "ftp-chroot" capability in login.conf(5). Howev-
er, the user must still supply a password. This feature is intended
as a compromise between a fully anonymous account and a fully privi-
leged account. The account should also be set up as for an anony-
mous account.
5. If the user name is ``anonymous'' or ``ftp'', an anonymous ftp ac-
count must be present in the password file (user ``ftp''). In this
case the user is allowed to log in by specifying any password (by
convention an email address for the user should be used as the pass-
word).
Once a user is authenticated the user must be approved by any approval
script defined (see login.conf(5)). If a valid approval script (by ei-
ther :approve=...: or :approve-ftp=...: for the users class) is defined
then it is run and must exit with a 0 (success) status. When ftpd is
running under the -D flag (and debugging is not turned on) then the ap-
proval script will be called with at least the following variables speci-
fied via the -v option (see login.conf(5)) to the approve script:
Variable Description
FTPD_SESSIONS Number of active ftp sessions, including this one
FTPD_HOST The server's (virtual) hostname
For example (the line is broken to fit the page):
/etc/ftpd/approve -v FTPD_SESSIONS=37 \
-v FTPD_HOST=ftp.mycompany.com username class service
When the user logs in to the anonymous ftp account, ftpd takes special
measures to restrict the client's access privileges. The server performs
a chroot(2) to the AnonymousDir directory. Only directories explicitly
listed in the /etc/ftpd/config file will allow anonymous uploads. In or-
der that system security is not breached, it is recommended that the
``ftp'' subtree be constructed with care, following these rules:
~ftp Make the home directory owned by ``root'' and unwritable
by anyone.
~ftp/bin You only need this directory if the BuiltinLS flag is not
set. If you do need this directory, make it owned by
``root'' and unwritable by anyone (mode 555). The pro-
gram ls(1) must be present to support the list command.
This program should be mode 111.
~ftp/etc Make this directory owned by ``root'' and unwritable by
anyone (mode 555). The files pwd.db (see passwd(5)) and
group(5) must be present for the ls command to be able to
produce owner names rather than numbers. The password
field in passwd is not used, and should not contain real
passwords. The file ftpd/motd, if present, will be
printed after a successful login. These files should be
mode 444.
~ftp/pub Make this directory mode 577 and owned by ``ftp''. Guests
can then place files which are to be accessible via the
anonymous account in this directory. Unless explicitly
allowed by the Incoming directive, anonymous ftp users
will not be able to store files in this directory.
If the system has multiple IP addresses, ftpd supports the idea of virtu-
al hosts, which provides the ability to define multiple anonymous ftp ar-
eas, each one allocated to a different internet address. The file
/etc/ftpd/config contains information pertaining to each of the virtual
hosts. See ftpconfig(5) for more details.
ADVANCED CONFIGURATION
Since ftpd uses the standard authentication and approval mechanisms de-
scribed in login.conf(5), the conditions which must be met to allow a
user to use ftp may be very flexible. By using the FTPD_SESSIONS and
FTPD_HOST variables passed to the approval program, nearly any complex
set of rules may be specified. Only the administrator's creativity lim-
its the possibilities.
LOGIN.CONF VARIABLES
In addition to any of the standard authentication parameters from
/etc/login.conf (see login.conf(5)), The ftpd daemon also uses the fol-
lowing ftp specific parameters:
auth-ftp The list of authentication types available to this class.
See login.conf(5).
ftp-chroot A boolean value. If set, users in this class will be auto-
matically chrooted to login directory for the user.
ftp-dir A path to a directory. This value overrides the login di-
rectory for the users of this class. From ftpd's stand-
point, this is the users login directory.
FILES
/etc/ftpd/config FTPD configuration file.
/etc/ftpd/banned List of unwelcome/restricted users.
/etc/ftpd/chroot List of normal users who should be chroot'd.
/etc/ftpd/welcome Welcome notice.
/etc/ftpd/motd Welcome notice after login.
/etc/nologin Displayed and access refused.
/var/log/ftpd/xferlog
Log file for transfers (see ftpconfig(5))
SEE ALSOftp(1), key(1), chroot(2), getusershell(3), ftpconfig(5),
login.conf(5), inetd(8), syslogd(8)BUGS
The server must run as the super-user to create sockets with privileged
port numbers. It maintains an effective user id of the logged in user,
reverting to the super-user only when binding addresses to sockets. The
possible security holes have been extensively scrutinized, but are possi-
bly incomplete.
HISTORY
The ftpd command appeared in 4.2BSD.
4.2 Berkeley Distribution January 2, 1998 5