FTPD(1M) FTPD(1M) NAME ftpd - Internet File Transfer Protocol server SYNOPSIS /usr/etc/ftpd [ -dhSlp ] [ -ttimeout ] [ -Tmaxtimeout ] [ -uumask ] DESCRIPTION Ftpd is the Internet File Transfer Protocol server process. The server uses the TCP protocol and listens at the well-known port specified in the services(4) file. Ftpd is started by inetd(1M) whenever a remote client makes a connection request. The following options should specified on the ftpd line in inetd's configuration file, /etc/inetd.conf. If the -l option is specified, each successful and failed ftp session login is logged in the syslog. If this option is specified twice, the retrieve (get), store (put), append, delete, make directory, remove directory and rename operations and their filename arguments are also logged. If this option is specified thrice, logging for the retrieve (get) and store (put) commands includes the number of bytes transferred. If the -d option is specified, verbose debugging information is written to the syslog. Note: this option logs all the commands and arguments that the client sends. However arguments from the PASS command for normal accounts are not logged. The -h option suppresses the use of the server's hostname in all responses, and suppresses version information in responses to the STAT command. The ftp server will timeout an inactive session after 15 minutes. If the -t option is specified, the inactivity timeout period will be set to timeout seconds. A client may also request a different timeout period; the maximum period allowed may be set to timeout seconds with the -T option. The default limit is 2 hours. The -u option specifies the default file protection mask (see umask(1)). If not specified, the default mask is set to 022 (group- and world- readable). A client may also request a different mask. The -S option turns on extra safety measures for anonymous FTP sites. For one thing, makes symbolic links appear to be ordinary links, so that links do not leak names in 'private' directories. (Those are directories that are not searchable by anonymous users.) The -p option causes the IP addresses of the data and control connections to be compared. Data transfer is allowed only if the IP address of the data recipient (or sender) is identical to the IP address used for the client's end of the control connection. This prevents the PORT command from redirecting the ftp-data connection to a third party and thereby provides added protection from network scanning. It also prevents data from being transferred to or from a third party while using passive data transfer mode. Note that the -p option precludes "proxy" ftp in which a client arranges for the transfer of data between two ftp servers. The file /etc/nologin can be used to disable ftp access. If the file exists, ftpd prints it and exits. If the file /etc/issue exists, ftpd prints it before issuing the ``ready'' message. The ftp server currently supports the following ftp requests; case is not distinguished. 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 EPRT specify extended port for data connection EPSV cause server to enter extended passive mode HELP give help information LIST give list files in a directory (``ls -lA'') 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 HELP give help information, e.g., SITE HELP 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 command 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 according to three rules. 1) The user name must be in the password data base, /etc/passwd, and not have a null password. In this case a password must be provided by the client before any file operations may be performed. 2) The user name must not appear in the file /etc/ftpusers. However, if the user name is in /etc/ftpusers followed by the white-space separated keyword ``restrict'', the user is allowed restricted access privileges, as described below. 3) If the user name is ``anonymous'' or ``ftp'', an anonymous ftp account 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 this is given as the client user and host name). For the restricted and anonymous accounts, ftpd takes special measures to restrict the client's access privileges. The server performs a chroot(2) command to the home directory of the user and prints the file README if it exists. In order that system security is not breached, it is recommended that the subtree be constructed with care; the following rules are recommended, using the ``ftp'' anonymous account as an example. If you allow logins as the ftp account, then you should instead make all the files and directories owned by a user and group other than ftp (or any other account that can login using the restricted passwd file in the chrooted tree), with the possible exception of directories to which you allow file transfers, such as ~ftp/pub. Remember that because the account name and password are valid, the user will be able to login directly or via telnet, rlogin, or rsh. This can be prevented, if desired, by using the feature documented in the passwd(4) man page, having the shell field start with *, and the home directory being a real or impossible base for the chrooted environment. See that manual page for more information. Note that ftpd uses the information in /etc/passwd to perform authentication and to establish its environment; i.e., ftpd does not use the etc/passwd file in the chrooted tree (unlike login(1)). ~ftp Make the home directory owned by ``bin'' and unwritable by anyone (mode 555 - see chmod(1)): chown bin ~ftp chmod a-w ~ftp ~ftp/bin Make this directory owned by the super-user and unwritable by anyone (mode 555). The program ls(1) must be present to support the list commands. This program should have mode 111. ~ftp/etc Make this directory owned by the super-user and unwritable by anyone (mode 555). The files passwd(4) and group(4) must be present for the ls command to be able to produce owner names rather than numbers. This should not be a copy of the real file in /etc, and in particular, it should contain no encrypted passwords from the real /etc/passwd or /etc/group. The password field in passwd is not used. Only the minimal number of accounts should be listed. These files should be mode 444. ~ftp/lib32 Make this directory own by the super-user and unwritable by anyone (mode 555). In order for ls to run, the files /lib32/rld and /lib32/libc.so.1 must be copied into lib32 (older releases, or some uses of other programs might also require the o32 versions in /lib. Both rld and libc.so.1 should be readable and executable by everyone, e.g. mode 555. ~ftp/dev Make this directory owned by the super-user and unwritable by anyone (mode 555). rld uses /dev/zero, so use mknod(1) to make a copy of /dev/zero in ~ftp/dev with the same major and minor device numbers. Make /dev/zero read-only (mode 444). mknod ~ftp/dev/zero c 37 0 chmod 444 ~ftp/dev/zero ~ftp/pub Make this directory owned by ``ftp''. If local users and remote anonymous users are to be allowed to write in this directory, change the directory's mode to 777. Users can then place files which are to be accessible via the anonymous account in this directory. If write accesses are to be denied, change the directory's mode to 555. FILES /etc/ftpusers list of unwelcome/restricted users /etc/issue welcome notice /etc/nologin disables access SEE ALSO login(1), ftp(1C), inetd(1M), rexecd(1M), syslogd(1M), passwd(4). BUGS The anonymous account is inherently dangerous and should avoided when possible. 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 possibly incomplete. Page 5