ftpd(1M)
NAME
ftpd − file transfer protocol server
SYNOPSIS
in.ftpd [ −dl ] [ −ttimeout ] host.socket
DESCRIPTION
ftpd is the Internet File Transfer Protocol ( FTP ) server process. The server is invoked by the Internet daemon inetd(1M) each time a connection to the FTP service (see services(4)) is made, with the connection available as descriptor 0 and the host and socket the connection originated from (in hex and decimal respectively) as an argument. Inactive connections are timed out after 90 seconds.
OPTIONS
−d Debugging information is logged to the system log daemon syslogd(1M).
−l Each FTP session is logged to the system log daemon syslogd(1M).
−ttimeout Set the inactivity timeout period to timeout , in seconds. The FTP server will timeout an inactive session after 15 minutes.
Requests
The FTP server currently supports the following FTP requests; case is not distinguished.
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
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
RETR retrieve a file
RMD remove a directory
RNFR specify rename-from file name
RNTO specify rename-to file name
STOR store a file
STOU store a file with a unique name
STRU specify data transfer structure
TYPE specify data transfer type
USER specify user name
XCUP change to parent of current working directory
XCWD change working directory
XMKD make a directory
XPWD print the current working directory
XRMD remove a directory
The remaining FTP requests specified in RFC 959 are recognized, but not implemented.
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 RFC 959.
ftpd interprets file names according to the “globbing” conventions used by sh(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) If the user name appears in the file /etc/ftpusers, ftp access is denied.
3) ftp access is denied unless 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 entry for the username "ftp" must be present in the password and shadow files. In this case the user is allowed to log in by specifying any password (by convention this is given as the client host’s name).
In the last case, ftpd takes special measures to restrict the client’s access privileges. The server performs 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 care; the following rules are recommended.
~ftp Make the home directory owned by ftp and unwritable by anyone.
~ftp/bin Make this directory owned by the super-user and unwritable by anyone. Make this a symbolic link to ~ftp/usr/bin The program ls(1) must be present to support the list commands. This program should have mode 111.
~ftp/usr/lib
Make this directory owned by the super-user and unwritable by anyone. Copy the following shared libraries from /usr/lib into this directory:
dl.so.∗
libc.so.∗
libdl.so.∗
libintl.so.∗
libw.so.∗
~ftp/etc Make this directory owned by the super-user and unwritable by anyone. Copies of the files passwd(4), group(4), and netconfig must be present for the ls command to work properly. These files should be mode 444.
~ftp/pub Make this directory mode 777 and owned by ftp. Users should then place files which are to be accessible via the anonymous account in this directory.
~ftp/dev Make this directory owned by the super-user and unwritable by anyone. Change directories to this directory. The following shell script will create the device node for /dev/tcp under the anonymous ftp user’s home directory:
FTP="‘grep ftp: /etc/passwd | cut -d: -f6‘"
MAJORMINOR="‘ls -lL /dev/tcp | nawk ’{ gsub(/,/, ""); print $5, $6}’‘"
mknod $FTP/dev/tcp c $MAJORMINOR
chmod 666 $FTP/dev/tcp
The /dev/zero device must be present under the ftp user’s /dev directory. Add the following text to the device-building script:
MAJORMINOR="‘ls -lL /dev/zero | nawk ’{ gsub(/,/, ""); print $5, $6}’‘"
mknod $FTP/dev/zero c $MAJORMINOR
chmod 666 $FTP/dev/zero
DIAGNOSTICS
ftpd logs various errors to syslogd, with a facility code of daemon.
Info Severity
These messages are logged only if the −l flag is specified.
FTPD: connection from host at time
A connection was made to ftpd from the host host at the date and time time.
FTPD: User user timed out after timeout seconds at time
The user user was logged out because they had not entered any commands after timeout seconds; the logout occurred at the date and time time.
Debug Severity
These messages are logged only if the −d flag is specified.
command
A command line containing command was read from the FTP client.
lost connection
The FTP client dropped the connection.
<−−− replycode
<−−− replycode−
A reply was sent to the FTP client with the reply code replycode. The next message logged will include the message associated with the reply. If a − follows the reply code, the reply is continued on later lines.
SEE ALSO
ftp(1), ls(1), aset(1M), inetd(1M), mknod(1M), syslogd(1M), chroot(2), getsockopt(3N), group(4), inetd.conf(4), netrc(4), passwd(4), services(4)
Postel, Jon, and Joyce Reynolds, File Transfer Protocol ( FTP ), RFC 959, Network Information Center, SRI International, Menlo Park, Calif., October 1985.
NOTES
The anonymous 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, reverting to the super-user only when binding addresses to sockets. The possible security holes have been extensively scrutinized, but are possibly incomplete.
/etc/ftpusers contains a list of users who cannot access the system; the format of the file is one username per line.
SunOS 5.2 — Last change: 10 Mar 1993