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