ftpd(1Mtcp)


ftpd -- Internet File Transfer Protocol server

Synopsis

in.ftpd [-aAdilLov] [-t timeout] [-T maxtimeout] [-u umask]

Description

ftpd 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(4tcp).

ftpd understands the following options:

-a
Enable the use of the ftpaccess configuration file.

-A
Disable the use of the ftpaccess configuration file (default).

-d
Write debugging information to the syslog file. Equivalent to -v.

-i
Log files received by the ftpd server to the xferlog file.

-l
Log each FTP session in the syslog file.

-L
Log commands sent to the ftpd server to the syslog file. Commands are logged as soon as the FTP server is invoked. This will cause the server to log all USER commands. If a user accidentally enters a password for that command instead of the username, the password will be logged in syslog.

-o
Log files transmitted by the ftpd server to the xferlog file.

-t timeout
Set the inactivity timeout period to timeout seconds. By default, the FTP server will timeout an inactive session after 900 seconds (15 minutes).

-T timeout
Set the maximum timeout period that a client may request. The default limit is 7200 seconds (2 hours).

-u umask
Set the default file-creation mode mask to umask (an octal integer).

-v
Write debugging information to the syslog file. Equivalent to -d.
The -i, -L and -o options are overridden by the use of the ftpaccess file.

The FTP server currently supports the following FTP requests; case (lower or upper) 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 -lgA)

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:

ALIAS
list aliases (which only apply to the cd command)

CDPATH
list the search path used when changing directory

CHMOD
change mode of a file, for example: SITE CHMOD 755 filename

EXEC
execute a program, for example: SITE EXEC program params

GPASS
give special group access password, for example: SITE GPASS bar

GROUP
request special group access, for example: SITE GROUP foo

GROUPS
list supplemental group membership

HELP
give help information, for example: SITE HELP

IDLE
set idle-timer, for example: SITE IDLE 60

INDEX
execute a local index command

LANG
change the language which the ftpd server uses to send messages to the client. When ftp establishes a connection, the value of LANG (if set in the environment) is passed to ftpd using the SITE LANG command

MINFO
like SITE NEWER, but gives extra information

NEWER
list files newer than a particular date

UMASK
change umask, for example: SITE UMASK 002

The remaining FTP requests specified in 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 four rules:

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 root and unwritable by anyone (mode 555).

~ftp/bin
Make this directory owned by root and executable but unreadable and unwritable by anyone (mode 111). The program ls(1) must be present to support the list command. This program should have mode 111.

~ftp/dev
Make this directory owned by root and executable but unreadable and unwritable by anyone (mode 111). Copy in the tcp and zero devices by executing the following command as root:

ls /dev/tcp /dev/zero | cpio -p ~ftp

~ftp/etc
Make this directory owned by root and executable but unreadable and unwritable by anyone (mode 111). Copy /etc/netconfig to this directory. Create passwd and group files from scratch. These files must be present for the ls command to be able to produce owner and group names rather than numbers. The passwd and group files should only contain entries corresponding to the owner/group of files under the anonymous FTP hierarchy (for example, root and ftp). Home directory pathnames and login shells need not be specified, and the password field should be left empty. These files should have mode 444 and be owned by root.

~ftp/pub
Make this directory owned by root and readable and executable by all users (mode 555).

~ftp/pub/incoming
If you want to allow anonymous users to upload files, create this directory owned by root with mode 1777. If you want to discourage abusers, set a mode of 1733 to make the directory unreadable. Note that the sticky bit is set to limit who is able to remove or rename files (see chmod(2)).

~ftp/usr
Make this directory owned by root and executable but unreadable and unwritable by anyone (mode 111).

~ftp/usr/lib
Make this directory owned by root and executable but unreadable and unwritable by anyone (mode 111). The library libc.so.1 must be present to support the list command. Copy the library from /usr/lib, and set the owner to root and the mode to 111.

General FTP extensions

Certain actions may be performed on the file when carrying out the RETR command, depending on how the destination filename is named. Note that these actions are controlled by the ftpconversions(4tcp) file and the tar and compress keywords in the ftpaccess(4tcp) file. The request will fail if the filename to be tar'ed is a directory containing a file named .notar.

Original Destination Action
filename.Z filename Decompress filename before transmitting
filename filename.Z Compress filename before transmitting
filename filename.tar Tar filename before transmitting
filename filename.tar.Z Tar and compress filename before transmitting

 
 ------------------------------------------------------------------------- 
| Original    |  Destination   |  Action                                 | 
|-------------|----------------|-----------------------------------------| 
| filename.Z  |  filename      |  Decompress filename before transmitting| 
|-------------|----------------|-----------------------------------------| 
| filename    |  filename.Z    |  Compress filename before transmitting  | 
|-------------|----------------|-----------------------------------------| 
| filename    |  filename.tar  |  Tar filename before transmitting       | 
|-------------|----------------|-----------------------------------------| 
| filename    |  filename.tar.Z|  Tar and compress filename before       | 
|             |                |  transmitting                           | 
|-------------|----------------|-----------------------------------------| 
For anonymous and guest users to be able to use these extensions, any commands listed in the ftpconversions(4tcp) file and any associated dynamic objects (determined using ldd(1)) must be present in the appropriate location under the anonymous and guest user's home directory hierarchy. Commands should normally have mode 111, and dynamic objects (with the exception of libc.so.1) mode 444.

Depending on the arguments to the passwd-check keyword in the ftpaccess file, the FTP server may attempt to check whether an anonymous user has supplied a valid e-mail address as their password.

If a user's FTP client hangs on ``long replies'' (responses consisting of multiple lines), they should use a dash as the first character of the password to stop the server sending continuation messages.

The FTP server can also log all file transmission and reception with the format described in xferlog(4tcp).

Files

/bin/ftp-exec
directory containing executables run by the EXEC command

/etc/ftpaccess
ftp server configuration file

/etc/ftpconversions
file name conversions

/etc/ftpgroups
additional group membership

/etc/ftphosts
individual user host access file

/etc/ftpusers
restricted user list

/etc/shells
allowable shell list

/var/adm/log/osmlog
default syslog filename

/var/adm/wtmpx
accounting information

/var/adm/xferlog
default transfer log file

References

ftp(1tcp), ftpaccess(4tcp), ftpconversions(4tcp), ftpusers(4tcp), syslogd(1M), umask(2), xferlog(4tcp)

RFC 959, RFC 1123

Notices

The anonymous account is inherently dangerous and should be avoided when possible.

The server must run as root to create sockets with privileged port numbers. It maintains an effective user ID of the logged in user, reverting to root only when binding addresses to sockets. The possible security holes have been extensively scrutinized, but are possibly incomplete.


30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.