1.\" Copyright (c) 1985, 1988, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" from: @(#)ftpd.8 8.2 (Berkeley) 4/19/94 33.\" $Id: ftpd.8,v 1.5 1994/06/29 01:49:43 deraadt Exp $ 34.\" 35.Dd April 19, 1994 36.Dt FTPD 8 37.Os BSD 4.2 38.Sh NAME 39.Nm ftpd 40.Nd 41Internet File Transfer Protocol server 42.Sh SYNOPSIS 43.Nm ftpd 44.Op Fl dl 45.Op Fl T Ar maxtimeout 46.Op Fl t Ar timeout 47.Sh DESCRIPTION 48.Nm Ftpd 49is the 50Internet File Transfer Protocol 51server process. The server uses the 52.Tn TCP 53protocol 54and listens at the port specified in the 55.Dq ftp 56service specification; see 57.Xr services 5 . 58.Pp 59Available options: 60.Bl -tag -width Ds 61.It Fl d 62Debugging information is written to the syslog using LOG_FTP. 63.It Fl l 64Each successful and failed 65.Xr ftp 1 66session is logged using syslog with a facility of LOG_FTP. 67If this option is specified twice, the retrieve (get), store (put), append, 68delete, make directory, remove directory and rename operations and 69their filename arguments are also logged. 70.It Fl T 71A client may also request a different timeout period; 72the maximum period allowed may be set to 73.Ar timeout 74seconds with the 75.Fl T 76option. 77The default limit is 2 hours. 78.It Fl t 79The inactivity timeout period is set to 80.Ar timeout 81seconds (the default is 15 minutes). 82.El 83.Pp 84The file 85.Pa /etc/nologin 86can be used to disable ftp access. 87If the file exists, 88.Nm 89displays it and exits. 90If the file 91.Pa /etc/ftpwelcome 92exists, 93.Nm 94prints it before issuing the 95.Dq ready 96message. 97If the file 98.Pa /etc/motd 99exists, 100.Nm 101prints it after a successful login. 102.Pp 103The ftp server currently supports the following ftp requests. 104The case of the requests is ignored. 105.Bl -column "Request" -offset indent 106.It Request Ta "Description" 107.It ABOR Ta "abort previous command" 108.It ACCT Ta "specify account (ignored)" 109.It ALLO Ta "allocate storage (vacuously)" 110.It APPE Ta "append to a file" 111.It CDUP Ta "change to parent of current working directory" 112.It CWD Ta "change working directory" 113.It DELE Ta "delete a file" 114.It HELP Ta "give help information" 115.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA" 116.It MKD Ta "make a directory" 117.It MDTM Ta "show last modification time of file" 118.It MODE Ta "specify data transfer" Em mode 119.It NLST Ta "give name list of files in directory" 120.It NOOP Ta "do nothing" 121.It PASS Ta "specify password" 122.It PASV Ta "prepare for server-to-server transfer" 123.It PORT Ta "specify data connection port" 124.It PWD Ta "print the current working directory" 125.It QUIT Ta "terminate session" 126.It REST Ta "restart incomplete transfer" 127.It RETR Ta "retrieve a file" 128.It RMD Ta "remove a directory" 129.It RNFR Ta "specify rename-from file name" 130.It RNTO Ta "specify rename-to file name" 131.It SITE Ta "non-standard commands (see next section)" 132.It SIZE Ta "return size of file" 133.It STAT Ta "return status of server" 134.It STOR Ta "store a file" 135.It STOU Ta "store a file with a unique name" 136.It STRU Ta "specify data transfer" Em structure 137.It SYST Ta "show operating system type of server system" 138.It TYPE Ta "specify data transfer" Em type 139.It USER Ta "specify user name" 140.It XCUP Ta "change to parent of current working directory (deprecated)" 141.It XCWD Ta "change working directory (deprecated)" 142.It XMKD Ta "make a directory (deprecated)" 143.It XPWD Ta "print the current working directory (deprecated)" 144.It XRMD Ta "remove a directory (deprecated)" 145.El 146.Pp 147The following non-standard or 148.Tn UNIX 149specific commands are supported 150by the 151SITE request. 152.Pp 153.Bl -column Request -offset indent 154.It Sy Request Ta Sy Description 155.It UMASK Ta change umask, e.g. ``SITE UMASK 002'' 156.It IDLE Ta set idle-timer, e.g. ``SITE IDLE 60'' 157.It CHMOD Ta change mode of a file, e.g. ``SITE CHMOD 755 filename'' 158.It HELP Ta give help information. 159.El 160.Pp 161The remaining ftp requests specified in Internet RFC 959 162are 163recognized, but not implemented. 164MDTM and SIZE are not specified in RFC 959, but will appear in the 165next updated FTP RFC. 166.Pp 167The ftp server will abort an active file transfer only when the 168ABOR 169command is preceded by a Telnet "Interrupt Process" (IP) 170signal and a Telnet "Synch" signal in the command Telnet stream, 171as described in Internet RFC 959. 172If a 173STAT 174command is received during a data transfer, preceded by a Telnet IP 175and Synch, transfer status will be returned. 176.Pp 177.Nm Ftpd 178interprets file names according to the 179.Dq globbing 180conventions used by 181.Xr csh 1 . 182This allows users to utilize the metacharacters 183.Dq Li \&*?[]{}~ . 184.Pp 185.Nm Ftpd 186authenticates users according to five rules. 187.Pp 188.Bl -enum -offset indent 189.It 190The login name must be in the password data base, 191.Pa /etc/passwd , 192and not have a null password. 193In this case a password must be provided by the client before any 194file operations may be performed. 195If the user has an S/Key key, the response from a successful USER 196command will include an S/Key challenge. The client may choose to respond 197with a PASS command giving either a standard password or an S/Key 198one-time password. The server will automatically determine which type of 199password it has been given and attempt to authenticate accordingly. See 200.Xr skey 1 201for more information on S/Key authentication. S/Key is a Trademark of 202Bellcore. 203.It 204The login name must not appear in the file 205.Pa /etc/ftpusers . 206.It 207The user must have a standard shell returned by 208.Xr getusershell 3 . 209.It 210If the user name appears in the file 211.Pa /etc/ftpchroot 212the session's root will be changed to the user's login directory by 213.Xr chroot 2 214as for an 215.Dq anonymous 216or 217.Dq ftp 218account (see next item). However, the user must still supply a password. 219This feature is intended as a compromise between a fully anonymous account 220and a fully privileged account. The account should also be set up as for an 221anonymous account. 222.It 223If the user name is 224.Dq anonymous 225or 226.Dq ftp , 227an 228anonymous ftp account must be present in the password 229file (user 230.Dq ftp ) . 231In this case the user is allowed 232to log in by specifying any password (by convention an email address for 233the user should be used as the password). 234.El 235.Pp 236In the last case, 237.Nm ftpd 238takes special measures to restrict the client's access privileges. 239The server performs a 240.Xr chroot 2 241to the home directory of the 242.Dq ftp 243user. 244In order that system security is not breached, it is recommended 245that the 246.Dq ftp 247subtree be constructed with care, following these rules: 248.Bl -tag -width "~ftp/pub" -offset indent 249.It Pa ~ftp 250Make the home directory owned by 251.Dq root 252and unwritable by anyone. 253.It Pa ~ftp/bin 254Make this directory owned by 255.Dq root 256and unwritable by anyone (mode 555). 257The program 258.Xr ls 1 259must be present to support the list command. 260This program should be mode 111. 261.It Pa ~ftp/etc 262Make this directory owned by 263.Dq root 264and unwritable by anyone (mode 555). 265The files 266.Xr passwd 5 267and 268.Xr group 5 269must be present for the 270.Xr ls 271command to be able to produce owner names rather than numbers. 272The password field in 273.Xr passwd 274is not used, and should not contain real passwords. 275The file 276.Pa motd , 277if present, will be printed after a successful login. 278These files should be mode 444. 279.It Pa ~ftp/pub 280Make this directory mode 777 and owned by 281.Dq ftp . 282Guests 283can then place files which are to be accessible via the anonymous 284account in this directory. 285.El 286.Sh FILES 287.Bl -tag -width /etc/ftpwelcome -compact 288.It Pa /etc/ftpusers 289List of unwelcome/restricted users. 290.It Pa /etc/ftpchroot 291List of normal users who should be chroot'd. 292.It Pa /etc/ftpwelcome 293Welcome notice. 294.It Pa /etc/motd 295Welcome notice after login. 296.It Pa /etc/nologin 297Displayed and access refused. 298.El 299.Sh SEE ALSO 300.Xr ftp 1 , 301.Xr skey 1 , 302.Xr getusershell 3 , 303.Xr syslogd 8 304.Sh BUGS 305The server must run as the super-user 306to create sockets with privileged port numbers. It maintains 307an effective user id of the logged in user, reverting to 308the super-user only when binding addresses to sockets. The 309possible security holes have been extensively 310scrutinized, but are possibly incomplete. 311.Sh HISTORY 312The 313.Nm 314command appeared in 315.Bx 4.2 . 316