ftpd(1M) — ADMINISTRATOR COMMANDS
NAME
ftpd − DARPA Internet File Transfer Protocol server
SYNOPSIS
in.ftpd [−d] [−l] [−ttimeout] [−Tmaxtimeout] host.socket
DESCRIPTION
The ftpd command is the Internet File Transfer Protocol (FTP) server process. The server is invoked by the Internet daemon inetd(1M) whenever a connection to the (FTP) service [see services(4)] is made: the connection will be available as descriptor 0; the host and socket from which the connection originated (in hexadecimal and in decimal respectively) will appear as an argument.
The FTP server will time out an inactive connection after 15 minutes.
OPTIONS
The following options are available:
−d Write debugging information to the syslog file.
−l Log each FTP session in the syslog.
−t timeout If the −t option is specified, the inactivity timeout period will be set to timeout seconds, with a default value of 15 minutes.
−T maxtimeout
If the −T option is specified, the maximum inactivity timeout period will be set to maxtimeout seconds, with a default value of 2 hours.
FTP REQUESTS
The FTP server currently supports the following FTP requests (without distinguishing between upper and lower case):
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 −lg”)
MKD make a directory
MDTM show last modification time of this file
MODE specify data transfer mode
NLST give name list of files in directory (“ls”)
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 file name rename-from
RNTO specify file name rename-to
SITE non-standard commands (see next section)
SIZE return the size of the file
STAT return the status of the file
STOR store a file
STOU store a file with a unique name
STRU specify data transfer structure
SYST show the Operating System type of the 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 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 RFC 959 are recognized, but not implemented. MDTM and SIZE are not specified in RFC 959, but are expected to appear in the next 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 by a TELNET “Synch” signal in the command stream (as described in RFC 959).
ftpd will interpret the file names according to the “globbing” conventions used by sh(1). This will allow users to utilize the following metacharacters: “∗”, “?”, “[”, “]”, “{”, “}”, and “~”.
ftpd will authenticate users according to the following rules:
1) The user name must be in the password data base, /etc/passwd, and not have a null password. Otherwise, a password must be provided by the client before any file operations may be performed.
2) If the user name appears in the file /etc/ftpusers, FTP access will be denied.
3) ftp access will be denied unless the user has a standard shell returned by getusershell(3), or the user’s shell (from /etc/passwd) is listed in the file /etc/shells, or the user’s shell is one of the following:
/bin/sh
/bin/ksh
/bin/csh
/usr/bin/sh
/usr/bin/ksh
/usr/bin/csh
4) 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 will be given as the user’s electronic mail address).
In the last case, ftpd will take special measures to restrict the client’s access privileges. The server will perform a chroot(2) command to the home directory of the “ftp” user. In order that system security is not breached, it is recommended that the “ftp” subtree be constructed with special care: the following rules are recommended.
home_directory
Make the home directory owned by “ftp” and unwritable by anyone else.
home_directory/bin
Make this directory owned by the super-user and unwritable by anyone. The program ls(1) must be present to support the list commands. This program should have mode 111. NOTE: Since ftpd does a chroot(2) for security purposes, it will not have access to the system’s dynamic libraries. This means that only statically linked versions of binaries should be placed in this directory. The ls program must be copied from /bin/ls and not from /usr/bin/ls. If you have installed the OCS add-on package, your version of /bin/ls will have been replaced. In that case, use the saved version which can be found in /usr/add-on/OCS/bin/ls.
home_directory/etc
Make this directory owned by the super-user and unwritable by anyone else. The password field in /etc/passwd will not be used and should not contain any real encrypted password. Copies of the files passwd(5), group(5), and netconfig must be present for the ls command to work properly. These files should be mode “444”.
home_directory/pub
Make this directory mode “777” and owned by “ftp”. Users should then place files which are to be accessible via the anonymous account into this directory.
home_directory/dev
Make this directory owned by the super-user and unwritable by anyone else. Change directories to this directory and do the following:
FTP="‘grep ^ftp: /etc/passwd | cut -d: -f6‘"
MAJORMINOR="‘ls -l /dev/tcp | nawk ’{ gsub(/,/, ""); print $5, $6}’‘"
mknod $FTP/dev/tcp c $MAJORMINOR
chmod 666 $FTP/dev/tcp
SEE ALSO
ftp(1), chroot(2), getusershell(3), getsockopt(3N), passwd(4), services(4), group(4), syslogd(1M).
RFC 959.
USER CONSIDERATIONS
An "anonymous" FTP account is inherently dangerous and should be 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, but will revert to super-user status only when binding addresses to sockets.
The possible security holes have been scrutinized extensively, but are possibly incomplete.
/etc/ftpusers contains a list of users who cannot access the system; the format of this file is one user name per line.
— Internet Utilities