| manpages.info - online man pages | ![]() |
|||
|
ftpd (8) Table of Contents
Nameftpd - Internet File Transfer Protocol server
Synopsisftpd [-dHlqQrsuUwWX] [-a anondir] [-c confdir] [-C user] [-e emailaddr] [-h hostname] [-P dataport] [-V version]
Descriptionftpd 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:
The file /etc/nologin can be used to disable FTP access. If the file exists, ftpd displays it and exits. If the file /etc/ftpwelcome exists, ftpd prints it before issuing the ``ready'' message. If the file /etc/motd exists (under the chroot directory if applicable), ftpd prints it after a successful login. This may be changed with the ftpd.conf(5) directive motd.
The ftpd server currently supports the following FTP requests. The case of the requests is ignored.
The following non-standard or UNIX specific commands are supported by the SITE request.
The following FTP requests (as specified in RFC 959) are recognized, but are not implemented: ACCT, SMNT, and REIN. MDTM and SIZE are not specified in RFC 959, but will appear in the next updated FTP RFC.
The ftpd 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 ``*?[]{}~''.
User authenticationftpd authenticates users according to five rules.
1. The login name must be in the system password data base and not have a null password. In this case a password must be provided by the client before any file operations may be performed. If the user has an S/Key key, the response from a successful USER command will include an S/Key challenge. The client may choose to respond with a PASS 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 /bin/sh.
4. If directed by the file ftpchroot(5) the session's root directory will be changed by chroot(2) to the directory specified in the ftpd.conf(5) chroot 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) chroot directive (if set), the -a anondir directory (if set), or to the home directory of the ``ftp'' user.
The server then performs a chdir(2) to the directory specified in the ftpd.conf(5) homedir directive (if set), otherwise to /.
If other restrictions are required (such as disabling of certain commands and the setting of a specific umask), then appropriate entries in ftpd.conf(5) are required.
If the first character of the password supplied by an anonymous user is ``-'', then the verbose messages displayed at login and upon a CWD command are suppressed.
Display file escape sequencesWhen ftpd displays various files back to the client (such as /etc/ftpwelcome and /etc/motd), various escape strings are replaced with information pertinent to the current connection.
The supported escape strings are:
Setting up a restricted ftp subtreeIn 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):
~ftp/incoming 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 people 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 permissions should be 770, otherwise they should be 370.
The following ftpd.conf(5)
directives should be
used:
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.
If you don't enable conversion commands, or don't want anonymous users uploading files here (see ~ftp/incoming above), then don't create this directory. However, error messages from conversion or LIST commands won't be returned to the user. (This is the traditional behaviour.) Note that the ftpd.conf(5) directive upload 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 /sbin/nologin to /sbin/ftplogin, and enter /sbin/ftplogin to /etc/shells to allow logging-in via FTP into the accounts, which must have /sbin/ftplogin as login shell.
Files
See Alsoftp(1) , skey(1) , who(1) , getusershell(3) , ftpd.conf(5) , ftpchroot(5) , ftpusers(5) , syslogd(8)
Standardsftpd recognizes all commands in RFC 959, follows the guidelines in RFC 1123, recognizes all commands in RFC 2228 (although they are not supported yet), and supports the extensions from RFC 2389, RFC 2428 and draft-ietf-ftpext-mlst-11.
HistoryThe ftpd command appeared in 4.2BSD.
Various features such as the ftpd.conf(5) functionality, RFC 2389, and draft-ietf-ftpext-mlst-11 support was implemented in NetBSD 1.3 and later releases by Luke Mewburn <lukem@netbsd.org>.
BugsThe 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 ftpd 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 addresses to privileged sockets. The -r option can be used to override this behaviour and force privileges to be permanently revoked; see SECURITY CONSIDERATIONS below for more details.
ftpd may have trouble handling connections from scoped IPv6 addresses, or IPv4 mapped addresses (IPv4 connection on AF_INET6 socket). For the latter case, running two daemons, one for IPv4 and one for IPv6, will avoid the problem.
Security ConsiderationsRFC 959 provides no restrictions on the PORT command, and this can lead to security problems, as ftpd can be fooled into connecting to any service on any host. With the ``checkportcmd'' feature of the ftpd.conf(5) , PORT 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 strongly recommended, and enabled by default.
By default ftpd uses a port that is one less than the port it is listening on to communicate back to the client for the EPRT, LPRT, and PORT commands, unless overridden with -P dataport. As the default port for ftpd (21) is a privileged port below IPPORT_RESERVED, ftpd 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 ftpd providing a remote root compromise, ftpd will permanently drop root privileges if one of the following is true:
1. ftpd is running on a port greater than IPPORT_RESERVED and the user has logged in as a `guest' or `chroot' user.
2. ftpd was invoked with -r.
Don't create ~ftp/tmp 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 upload, then this directory cannot be abused by the user in this way, so it should be safe to create.
|