head 1.2; access; symbols tnftpd-2-0-beta3:1.1 tnftpd-2-0-beta2:1.1 tnftpd-2-0-beta1:1.1; locks; strict; comment @# @; 1.2 date 2003.02.28.03.54.59; author lukem; state dead; branches; next 1.1; 1.1 date 2002.10.26.12.22.51; author lukem; state Exp; branches; next ; desc @@ 1.2 log @regenerate from mdoc sources (with ftpd.8 -> tnftpd.cat8) @ text @FTPD(8) NetBSD System Manager's Manual FTPD(8) NNAAMMEE ffttppdd - Internet File Transfer Protocol server SSYYNNOOPPSSIISS ffttppdd [--ddHHllqqQQrrssuuUUwwWWXX] [--aa _a_n_o_n_d_i_r] [--cc _c_o_n_f_d_i_r] [--CC _u_s_e_r] [--ee _e_m_a_i_l_a_d_d_r] [--hh _h_o_s_t_n_a_m_e] [--PP _d_a_t_a_p_o_r_t] [--VV _v_e_r_s_i_o_n] DDEESSCCRRIIPPTTIIOONN ffttppdd 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). Available options: --aa _a_n_o_n_d_i_r Define _a_n_o_n_d_i_r as the directory to chroot(2) into for anonymous logins. Default is the home directory for the ftp user. This can also be specified with the ftpd.conf(5) cchhrroooott directive. --cc _c_o_n_f_d_i_r Change the root directory of the configuration files from ``_/_e_t_c'' to _c_o_n_f_d_i_r. This changes the directory for the follow- ing files: _/_e_t_c_/_f_t_p_c_h_r_o_o_t, _/_e_t_c_/_f_t_p_u_s_e_r_s, _/_e_t_c_/_f_t_p_w_e_l_c_o_m_e, _/_e_t_c_/_m_o_t_d, and the file specified by the ftpd.conf(5) lliimmiitt di- rective. --CC _u_s_e_r Check whether _u_s_e_r would be granted access under the restrictions given in ftpusers(5) and exit without attempting a connection. ffttppdd exits with an exit code of 0 if access would be granted, or 1 otherwise. This can be useful for testing configurations. --dd Debugging information is written to the syslog using a facility of LOG_FTP. --ee _e_m_a_i_l_a_d_d_r Use _e_m_a_i_l_a_d_d_r for the ``%E'' escape sequence (see _D_i_s_p_l_a_y _f_i_l_e _e_s_c_a_p_e _s_e_q_u_e_n_c_e_s) --hh _h_o_s_t_n_a_m_e Explicitly set the hostname to advertise as to _h_o_s_t_n_a_m_e. The de- fault is the hostname associated with the IP address that ffttppdd is listening on. This ability (with or without --hh), in conjunction with --cc _c_o_n_f_d_i_r, is useful when configuring `virtual' FTP servers, each listening on separate addresses as separate names. Refer to inetd.conf(5) for more information on starting services to listen on specific IP addresses. --HH Equivalent to ``-h `hostname`''. --ll Each successful and failed FTP session is logged using syslog with a facility of LOG_FTP. If this option is specified more than once, the retrieve (get), store (put), append, delete, make directory, remove directory and rename operations and their file name arguments are also logged. --PP _d_a_t_a_p_o_r_t Use _d_a_t_a_p_o_r_t as the data port, overriding the default of using the port one less that the port ffttppdd is listening on. --qq Enable the use of pid files for keeping track of the number of logged-in users per class. This is the default. --QQ Disable the use of pid files for keeping track of the number of logged-in users per class. This may reduce the load on heavily loaded FTP servers. --rr Permanently drop root privileges once the user is logged in. The use of this option may result in the server using a port other than the (listening-port - 1) for PPOORRTT style commands, which is contrary to the RRFFCC 995599 specification, but in practice very few clients rely upon this behaviour. See _S_E_C_U_R_I_T_Y _C_O_N_S_I_D_E_R_A_T_I_O_N_S below for more details. --ss Require a secure authentication mechanism like Kerberos or S/Key to be used. --uu Log each concurrent FTP session to _/_v_a_r_/_r_u_n_/_u_t_m_p, making them visible to commands such as who(1). --UU Don't log each concurrent FTP session to _/_v_a_r_/_r_u_n_/_u_t_m_p. This is the default. --VV _v_e_r_s_i_o_n Use _v_e_r_s_i_o_n as the version to advertise in the login banner and in the output of SSTTAATT and SSYYSSTT instead of the default version in- formation. If _v_e_r_s_i_o_n is empty or `-' then don't display any version information. --ww Log each FTP session to _/_v_a_r_/_l_o_g_/_w_t_m_p, making them visible to commands such as last(1). This is the default. --WW Don't log each FTP session to _/_v_a_r_/_l_o_g_/_w_t_m_p. --XX Log wu-ftpd style `xferlog' entries to the syslog, prefixed with ``xferlog: '', using a facility of LOG_FTP. These syslog entries can be converted to a wu-ftpd style _x_f_e_r_l_o_g file suitable for in- put into a third-party log analysis tool with a command similar to: grep 'xferlog: ' /var/log/xferlog | \ sed -e 's/^.*xferlog: //' > wuxferlog The file _/_e_t_c_/_n_o_l_o_g_i_n can be used to disable FTP access. If the file ex- ists, ffttppdd displays it and exits. If the file _/_e_t_c_/_f_t_p_w_e_l_c_o_m_e exists, ffttppdd prints it before issuing the ``ready'' message. If the file _/_e_t_c_/_m_o_t_d exists (under the chroot directory if applicable), ffttppdd prints it after a successful login. This may be changed with the ftpd.conf(5) directive mmoottdd. The ffttppdd server currently supports the following FTP requests. The case of the requests is ignored. RReeqquueesstt DDeessccrriippttiioonn 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 EPSV prepare for server-to-server transfer EPRT specify data connection port FEAT list extra features that are not defined in RRFFCC 995599 HELP give help information LIST give list files in a directory (``ls -lA'') LPSV prepare for server-to-server transfer LPRT specify data connection port MLSD list contents of directory in a machine-processable form MLST show a pathname in a machine-processable form MKD make a directory MDTM show last modification time of file MODE specify data transfer _m_o_d_e NLST give name list of files in directory NOOP do nothing OPTS define persistent options for a given command 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 _s_t_r_u_c_t_u_r_e SYST show operating system type of server system TYPE specify data transfer _t_y_p_e 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. RReeqquueesstt DDeessccrriippttiioonn CHMOD change mode of a file, e.g. ``SITE CHMOD 755 filename'' HELP give help information. IDLE set idle-timer, e.g. ``SITE IDLE 60'' RATEGET set maximum get rate throttle in bytes/second, e.g. ``SITE RATEGET 5k'' RATEPUT set maximum put rate throttle in bytes/second, e.g. ``SITE RATEPUT 5k'' UMASK change umask, e.g. ``SITE UMASK 002'' The following FTP requests (as specified in RRFFCC 995599) are recognized, but are not implemented: AACCCCTT, SSMMNNTT, and RREEIINN. MMDDTTMM and SSIIZZEE are not speci- fied in RRFFCC 995599, but will appear in the next updated FTP RFC. The ffttppdd server will abort an active file transfer only when the AABBOORR command is preceded by a Telnet "Interrupt Process" (IP) signal and a Telnet "Synch" signal in the command Telnet stream, as described in In- ternet RRFFCC 995599. If a SSTTAATT command is received during a data transfer, preceded by a Telnet IP and Synch, transfer status will be returned. ffttppdd interprets file names according to the ``globbing'' conventions used by csh(1). This allows users to utilize the metacharacters ``*?[]{}~''. UUsseerr aauutthheennttiiccaattiioonn ffttppdd authenticates users according to five rules. 1. The login name must be in the password data base, _/_e_t_c_/_p_w_d_._d_b, and not have a null password. In this case a password must be provided by the client before any file operations may be per- formed. If the user has an S/Key key, the response from a successful UUSSEERR command will include an S/Key challenge. The client may choose to respond with a PPAASSSS command giving either a standard password or an S/Key one-time password. The server will automatically determine which type of password it has been given and attempt to authenticate accordingly. See skey(1) for more information on S/Key authentication. S/Key is a Trademark of Bellcore. 2. The login name must be allowed based on the information in ftpusers(5). 3. The user must have a standard shell returned by getusershell(3). If the user's shell field in the password database is empty, the shell is assumed to be _/_b_i_n_/_s_h. As per shells(5), the user's shell must be listed with full path in _/_e_t_c_/_s_h_e_l_l_s. 4. If directed by the file ftpchroot(5) the session's root direc- tory will be changed by chroot(2) to the directory specified in the ftpd.conf(5) cchhrroooott directive (if set), or to the home directory of the user. However, the user must still supply a password. This feature is intended as a compromise between a fully anonymous account and a fully privileged account. The account should also be set up as for an anonymous account. 5. 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 an email address for the user should be used as the password). The server performs a chroot(2) to the directory specified in the ftpd.conf(5) cchhrroooott directive (if set), the --aa _a_n_o_n_d_i_r di- rectory (if set), or to the home directory of the ``ftp'' us- er. The server then performs a chdir(2) to the directory specified in the ftpd.conf(5) hhoommeeddiirr directive (if set), otherwise to _/. If other restrictions are required (such as disabling of cer- tain commands and the setting of a specific umask), then ap- propriate entries in ftpd.conf(5) are required. If the first character of the password supplied by an anony- mous user is ``-'', then the verbose messages displayed at lo- gin and upon a CCWWDD command are suppressed. DDiissppllaayy ffiillee eessccaappee sseeqquueenncceess When ffttppdd displays various files back to the client (such as _/_e_t_c_/_f_t_p_w_e_l_c_o_m_e and _/_e_t_c_/_m_o_t_d), various escape strings are replaced with information pertinent to the current connection. The supported escape strings are: EEssccaappee DDeessccrriippttiioonn %c Class name. %C Current working directory. %E Email address given with --ee. %L Local hostname. %M Maximum number of users for this class. Displays ``unlimited'' if there's no limit. %N Current number of users for this class. %R Remote hostname. %s If the result of the most recent ``%M'' or ``%N'' was not ``1'', print an ``s''. %S If the result of the most recent ``%M'' or ``%N'' was not ``1'', print an ``S''. %T Current time. %U User name. %% A ``%'' character. SSeettttiinngg uupp aa rreessttrriicctteedd ffttpp ssuubbttrreeee In order that system security is not breached, it is recommended that the subtrees for the ``ftp'' and ``chroot'' accounts be constructed with care, following these rules (replace ``ftp'' in the following directory names with the appropriate account name for `chroot' users): _~_f_t_p Make the home directory owned by ``root'' and un- writable by anyone. _~_f_t_p_/_b_i_n Make this directory owned by ``root'' and unwritable by anyone (mode 555). Generally any conversion com- mands should be installed here (mode 111). _~_f_t_p_/_e_t_c Make this directory owned by ``root'' and unwritable by anyone (mode 555). The files _p_w_d_._d_b (see passwd(5)) and _g_r_o_u_p (see group(5)) must be present for the LLIISSTT command to be able to display owner and group names instead of numbers. The password field in passwd(5) is not used, and should not contain re- al passwords. The file _m_o_t_d, if present, will be printed after a successful login. These files should be mode 444. _~_f_t_p_/_p_u_b This directory and the subdirectories beneath it should be owned by the users and groups responsible for placing files in them, and be writable only by them (mode 755 or 775). They should _n_o_t be owned or writable by ftp or its group. _~_f_t_p_/_i_n_c_o_m_i_n_g This directory is where anonymous users place files they upload. The owners should be the user ``ftp'' and an appropriate group. Members of this group will be the only users with access to these files after they have been uploaded; these should be peo- ple who know how to deal with them appropriately. If you wish anonymous FTP users to be able to see the names of the files in this directory the permis- sions should be 770, otherwise they should be 370. The following ftpd.conf(5) directives should be used: modify guest off umask guest 0707 upload guest on This will result in anonymous users being able to upload files to this directory, but they will not be able to download them, delete them, or overwrite them, due to the umask and disabling of the commands mentioned above. _~_f_t_p_/_t_m_p This directory is used to create temporary files which contain the error messages generated by a con- version or LLIISSTT command. The owner should be the user ``ftp''. The permissions should be 300. If you don't enable conversion commands, or don't want anonymous users uploading files here (see _~_f_t_p_/_i_n_c_o_m_i_n_g above), then don't create this direc- tory. However, error messages from conversion or LLIISSTT commands won't be returned to the user. (This is the traditional behaviour.) Note that the ftpd.conf(5) directive uuppllooaadd can be used to prevent users uploading here. To set up "ftp-only" accounts that provide only FTP, but no valid shell login, you can copy/link _/_s_b_i_n_/_n_o_l_o_g_i_n to _/_s_b_i_n_/_f_t_p_l_o_g_i_n, and enter _/_s_b_i_n_/_f_t_p_l_o_g_i_n to _/_e_t_c_/_s_h_e_l_l_s to allow logging-in via FTP into the ac- counts, which must have _/_s_b_i_n_/_f_t_p_l_o_g_i_n as login shell. FFIILLEESS /etc/ftpchroot List of normal users whose root directory should be changed via chroot(2). /etc/ftpd.conf Configure file conversions and other settings. /etc/ftpusers List of unwelcome/restricted users. /etc/ftpwelcome Welcome notice before login. /etc/motd Welcome notice after login. /etc/nologin If it exists, displayed and access is refused. /var/run/ftpd.pids-CLASS State file of logged-in processes for the ffttppdd class `CLASS'. /var/run/utmp List of logged-in users on the system. /var/log/wtmp Login history database. SSEEEE AALLSSOO ftp(1), skey(1), who(1), getusershell(3), ftpchroot(5), ftpd.conf(5), ftpusers(5), syslogd(8) SSTTAANNDDAARRDDSS ffttppdd recognizes all commands in RRFFCC 995599, follows the guidelines in RRFFCC 11112233, recognizes all commands in RRFFCC 22222288 (although they are not support- ed yet), and supports the extensions from RRFFCC 22338899, RRFFCC 22442288 and ddrraafftt-- iieettff--ffttppeexxtt--mmllsstt--1111. HHIISSTTOORRYY The ffttppdd command appeared in 4.2BSD. Various features such as the ftpd.conf(5) functionality, RRFFCC 22338899, and ddrraafftt--iieettff--ffttppeexxtt--mmllsstt--1111 support was implemented in NetBSD 1.3 and later releases by Luke Mewburn. BBUUGGSS The server must run as the super-user to create sockets with privileged port numbers (i.e, those less than IPPORT_RESERVED, which is 1024). If ffttppdd is listening on a privileged port it maintains an effective user id of the logged in user, reverting to the super-user only when binding ad- dresses to privileged sockets. The --rr option can be used to override this behaviour and force privileges to be permanently revoked; see _S_E_C_U_R_I_T_Y _C_O_N_S_I_D_E_R_A_T_I_O_N_S below for more details. ffttppdd may have trouble handling connections from scoped IPv6 addresses, or IPv4 mapped addresses (IPv4 connection on AF_INET6 socket). For the lat- ter case, running two daemons, one for IPv4 and one for IPv6, will avoid the problem. SSEECCUURRIITTYY CCOONNSSIIDDEERRAATTIIOONNSS RRFFCC 995599 provides no restrictions on the PPOORRTT command, and this can lead to security problems, as ffttppdd can be fooled into connecting to any ser- vice on any host. With the ``checkportcmd'' feature of the ftpd.conf(5), PPOORRTT commands with different host addresses, or TCP ports lower than IPPORT_RESERVED will be rejected. This also prevents `third-party proxy ftp' from working. Use of this option is _s_t_r_o_n_g_l_y recommended, and en- abled by default. By default ffttppdd uses a port that is one less than the port it is listen- ing on to communicate back to the client for the EEPPRRTT, LLPPRRTT, and PPOORRTT commands, unless overridden with --PP _d_a_t_a_p_o_r_t. As the default port for ffttppdd (21) is a privileged port below IPPORT_RESERVED, ffttppdd retains the ability to switch back to root privileges to bind these ports. In order to increase security by reducing the potential for a bug in ffttppdd provid- ing a remote root compromise, ffttppdd will permanently drop root privileges if one of the following is true: 1. ffttppdd is running on a port greater than IPPORT_RESERVED and the user has logged in as a `guest' or `chroot' user. 2. ffttppdd was invoked with --rr. Don't create _~_f_t_p_/_t_m_p if you don't want anonymous users to upload files there. That directory is only necessary if you want to display the error messages of conversion commands to the user. Note that if uploads are disabled with the ftpd.conf(5) directive uuppllooaadd, then this directory can- not be abused by the user in this way, so it should be safe to create. NetBSD 1.6 October 25, 2002 7 @ 1.1 log @- convert to using tnftpd.h - generate the man pages - crank the version back to 2.0 beta 1 - remove now unnecessary files @ text @@