Debian Codegraph @

upstream/debian-unstable/man8/in.ftpd.8

raw
1 .\"
2 .\" Copyright (c) 1985, 1988, 1991, 1993
3 .\" The Regents of the University of California. All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgement:
15 .\" This product includes software developed by the University of
16 .\" California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\"
33 .\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94
34 .\" NetBSD: ftpd.8,v 1.8 1996/01/14 20:55:23 thorpej Exp
35 .\" OpenBSD: ftpd.8,v 1.9 1996/12/03 03:07:16 deraadt Exp
36 .\" OpenBSD: ftpd.8,v 1.12 1997/05/01 14:45:36 deraadt Exp
37 .\" OpenBSD: ftpd.8,v 1.22 1999/07/09 13:35:50 aaron Exp
38 .\" $Id: ftpd.8,v 1.17 2000/07/30 23:56:57 dholland Exp $
39 .\"
40 .Dd September 14, 1999
41 .Dt FTPD 8
42 .Os "Linux NetKit (0.17)"
43 .Sh NAME
44 .Nm ftpd
45 .Nd
46 Internet File Transfer Protocol server
47 .Sh SYNOPSIS
48 .Nm ftpd
49 .Op Fl AdDhlMnPSU
50 .Op Fl T Ar maxtimeout
51 .Op Fl t Ar timeout
52 .Op Fl u Ar mask
53 .Op Fl z Ar debug
54 .Op Fl z Ar debug=file
55 .Op Fl z Ar certsok
56 .Op Fl z Ar certrequired
57 .Op Fl z Ar secure
58 .Op Fl z Ar ssl
59 .Op Fl z Ar verify=flags
60 .Op Fl z Ar cacert=cafile
61 .Op Fl z Ar cert=certfile
62 .Op Fl z Ar key=keyfile
63 .Op Fl z Ar cipher=list
64 .Op Fl z Ar legacy
65 .Sh DESCRIPTION
66 .Nm Ftpd
67 is the
68 Internet File Transfer Protocol
69 server process. The server uses the
70 .Tn TCP
71 protocol
72 and listens at the port specified in the
73 .Dq ftp
74 service specification; see
75 .Xr services 5 .
76 .Pp
77 Available options:
78 .Bl -tag -width Ds
79 .It Fl 4
80 Use IPv4 addressing only. The default is to offer service for both families, IPv6 and IPv4.
81 .It Fl 6
82 Only provide IPv6 addressing capability.
83 .It Fl A
84 Permit only anonymous ftp connections or accounts listed in
85 .Pa /etc/ftpchroot.
86 Other connection attempts are refused. This option is no longer effective if
87 PAM is enabled. Please refer to the README file for instructions to doing
88 this with PAM.
89 .It Fl d
90 Debugging information is written to the syslog using LOG_FTP.
91 .It Fl D
92 With this option set,
93 .Nm ftpd
94 will detach and become a daemon, accepting connections on the FTP port and
95 forking child processes to handle them. This has lower overhead than
96 starting
97 .Nm ftpd
98 from
99 .Xr inetd 8
100 and is thus useful on busy servers to reduce load.
101 .It Fl h
102 The server will use data ports in the high port range for passive connections.
103 This range is defined by the
104 .Ev IPPORT_HIFIRSTAUTO
105 and
106 .Ev IPPORT_HILASTAUTO
107 defines in <netinet/in.h>. In
108 .Ox
109 they are set to 49152 and 65535 respectively.
110 .It Fl l
111 Each successful and failed
112 .Xr ftp 1
113 session is logged using syslog with a facility of LOG_FTP.
114 If this option is specified twice, the retrieve (get), store (put), append,
115 delete, make directory, remove directory and rename operations and
116 their filename arguments are also logged.
117 .It Fl M
118 Enables multihomed mode. Instead of simply using
119 .Pa ~ftp
120 for anonymous transfers, a directory matching the fully qualified name of
121 the IP number the client connected to, and located inside
122 .Pa ~ftp
123 is used instead.
124 .It Fl n
125 Use numeric IP addresses in logs instead of doing hostname lookup.
126 .It Fl P
127 Permit illegal port numbers or addresses for PORT command initiated connects.
128 By default
129 .Xr ftpd 8
130 violates the RFC and thus constrains the PORT command to non-reserved ports
131 and requires it use the same source address as the connection came from.
132 This prevents the "FTP bounce attack" against services on both the local
133 machine and other local machines.
134 .It Fl S
135 With this option set,
136 .Nm ftpd
137 logs all anonymous transfers to the file
138 .Pa /var/log/ftpd
139 when this file exists.
140 .It Fl U
141 Each concurrent
142 .Xr ftp 1
143 session is logged to the file
144 .Pa /var/run/utmp ,
145 making them visible to commands such as
146 .Xr who 1 .
147 This option at present is unsupporte and will always silently fail.
148 .It Fl T
149 A client may also request a different timeout period;
150 the maximum period allowed may be set to
151 .Ar timeout
152 seconds with the
153 .Fl T
154 option.
155 The default limit is 2 hours.
156 .It Fl t
157 The inactivity timeout period is set to
158 .Ar timeout
159 seconds (the default is 15 minutes).
160 .It Fl u
161 Change the default umask from 027 to
162 .Ar mask .
163 .It Fl z Ar SSL-parameter
164 This option is only valid if
165 .Nm ftpd
166 has been built with SSL (Secure Socket Layer) support.
167 .Bl -tag -width Fl
168 .It Ic secure
169 Don't fall back to unencrypted mode, that is without SSL, if the client
170 is not explicitly asking for SSL mode. In this server mode
171 .Nm ftpd
172 only accepts connections from SSL enhanced
173 .Ar FTP clients
174 with an option similar to
175 .Ic -z secure
176 in active use.
177 .It Ic ssl
178 Negotiate SSL at first, then fall back to legacy FTP protocol.
179 .It Ic nossl, !ssl
180 switch off SSL negotiation
181 .It Ic debug
182 Enable SSL related debugging. Useless in non-daemon mode.
183 .It Ic debug=file
184 Direct the debugging output to
185 .Ar file .
186 .It Ic certsok
187 Look username up in
188 .Pa /etc/ssl.users .
189 The format of this file is lines of this form:
190 .Ar user1,user2:/C=US/...
191 .br
192 where
193 .Ar user1
194 and
195 .Ar user2
196 are usernames. If the client certificate is valid,
197 authenticate with any password. Use a command
198 .Ar openssl x509 -noout -subject
199 to extract the needed fields, all of which are needed.
200 .It Ic certrequired
201 Client certificate is mandatory and the user must be matched to the
202 corresponding subject identifier listed in
203 .Pa /etc/ssl.users .
204 .It Ic verify=int
205 Set the SSL verify flags (use combinations of SSL_VERIFY_* from
206 .Ar openssl/ssl.h
207 ).
208 .It Ic cacert=ca_file
209 Use the CA certificates stored in
210 .Ar ca_file
211 to verify the identity of the peer client.
212 The subject names found herein are given to the client for
213 whatever use they may present. A clever client software is able
214 to choose its identity hinted by this list.
215 .It Ic cert=cert_file
216 Use the certificate(s) in
217 .Ar cert_file
218 instead of the default location
219 .Pa /etc/ftpd-ssl/ftpd.pem .
220 This is a PEM formatted file. The first certificate identifies the
221 server and the rest of the chain is used for verification purposes
222 while talking to the peer client.
223 .It Ic key=key_file
224 Use the key stored in
225 .Ar key_file ,
226 should the certificate file not contain the required private key.
227 .It Ic cipher=ciph_list
228 Set the preferred ciphers to
229 .Ar ciph_list .
230 See
231 .Ar openssl/ssl.h
232 for more information).
233 .It Ic legacy
234 This is a compatibility option, which activates a work around during
235 verification, which the legacy code depended on.
236 It should not be used now that chains and CA lists are available,
237 but is introduced to ease the transition to the better implementation.
238 .El
239 .El
240 .Pp
241 The file
242 .Pa /etc/nologin
243 can be used to disable ftp access.
244 If the file exists,
245 .Nm
246 displays it and exits.
247 If the file
248 .Pa /etc/ftpwelcome
249 exists,
250 .Nm
251 prints it before issuing the
252 .Dq ready
253 message.
254 If the file
255 .Pa /etc/motd
256 exists,
257 .Nm
258 prints it after a successful login. If the file
259 .Pa .message
260 exists in a directory,
261 .Nm
262 prints it when that directory is entered.
263 .Pp
264 The ftp server currently supports the following ftp requests.
265 The case of the requests is ignored.
266 .Bl -column "Request" -offset indent
267 .It Request Ta "Description"
268 .It ABOR Ta "abort previous command"
269 .It ACCT Ta "specify account (ignored)"
270 .It ALLO Ta "allocate storage (vacuously)"
271 .It APPE Ta "append to a file"
272 .It CDUP Ta "change to parent of current working directory"
273 .It CWD Ta "change working directory"
274 .It DELE Ta "delete a file"
275 .It EPRT Ta "specify data connection port, either IPv4 or IPv6"
276 .It EPSV Ta "ask for a server port for fetching data"
277 .It HELP Ta "give help information"
278 .It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA"
279 .It MKD Ta "make a directory"
280 .It MDTM Ta "show last modification time of file"
281 .It MODE Ta "specify data transfer" Em mode
282 .It NLST Ta "give name list of files in directory"
283 .It NOOP Ta "do nothing"
284 .It PASS Ta "specify password"
285 .It PASV Ta "prepare for server-to-server transfer"
286 .It PORT Ta "specify data connection port"
287 .It PWD Ta "print the current working directory"
288 .It QUIT Ta "terminate session"
289 .It REST Ta "restart incomplete transfer"
290 .It RETR Ta "retrieve a file"
291 .It RMD Ta "remove a directory"
292 .It RNFR Ta "specify rename-from file name"
293 .It RNTO Ta "specify rename-to file name"
294 .It SITE Ta "non-standard commands (see next section)"
295 .It SIZE Ta "return size of file"
296 .It STAT Ta "return status of server"
297 .It STOR Ta "store a file"
298 .It STOU Ta "store a file with a unique name"
299 .It STRU Ta "specify data transfer" Em structure
300 .It SYST Ta "show operating system type of server system"
301 .It TYPE Ta "specify data transfer" Em type
302 .It USER Ta "specify user name"
303 .It XCUP Ta "change to parent of current working directory (deprecated)"
304 .It XCWD Ta "change working directory (deprecated)"
305 .It XMKD Ta "make a directory (deprecated)"
306 .It XPWD Ta "print the current working directory (deprecated)"
307 .It XRMD Ta "remove a directory (deprecated)"
308 .El
309 .Pp
310 The following non-standard or
311 .Tn UNIX
312 specific commands are supported
313 by the
314 SITE request.
315 .Pp
316 .Bl -column Request -offset indent
317 .It Sy Request Ta Sy Description
318 .It UMASK Ta change umask, e.g. ``SITE UMASK 002''
319 .It IDLE Ta set idle-timer, e.g. ``SITE IDLE 60''
320 .It CHMOD Ta change mode of a file, e.g. ``SITE CHMOD 755 filename''
321 .It HELP Ta give help information.
322 .El
323 .Pp
324 The remaining ftp requests specified in Internet RFC 959
325 are
326 recognized, but not implemented.
327 MDTM and SIZE are not specified in RFC 959, but will appear in the
328 next updated FTP RFC.
329 .Pp
330 The ftp server will abort an active file transfer only when the
331 ABOR
332 command is preceded by a Telnet "Interrupt Process" (IP)
333 signal and a Telnet "Synch" signal in the command Telnet stream,
334 as described in Internet RFC 959.
335 If a
336 STAT
337 command is received during a data transfer, preceded by a Telnet IP
338 and Synch, transfer status will be returned.
339 .Pp
340 .Nm Ftpd
341 interprets file names according to the
342 .Dq globbing
343 conventions used by
344 .Xr csh 1 .
345 This allows users to utilize the metacharacters
346 .Dq Li \&*?[]{}~ .
347 .Pp
348 .Nm Ftpd
349 authenticates users according to five rules.
350 .Pp
351 .Bl -enum -offset indent
352 .It
353 The login name must be in the password data base,
354 .\" .Pa /etc/pwd.db ,
355 .Pa /etc/passwd ,
356 and not have a null password.
357 In this case a password must be provided by the client before any
358 file operations may be performed.
359 If the user has an S/Key key, the response from a successful USER
360 command will include an S/Key challenge. The client may choose to respond
361 with a PASS command giving either a standard password or an S/Key
362 one-time password. The server will automatically determine which type of
363 password it has been given and attempt to authenticate accordingly. See
364 .Xr skey 1
365 for more information on S/Key authentication. S/Key is a Trademark of
366 Bellcore.
367 .It
368 The login name must not appear in the file
369 .Pa /etc/ftpusers .
370 .It
371 The user must have a standard shell returned by
372 .Xr getusershell 3 .
373 .It
374 If the user name appears in the file
375 .Pa /etc/ftpchroot
376 the session's root will be changed to the user's login directory by
377 .Xr chroot 2
378 as for an
379 .Dq anonymous
380 or
381 .Dq ftp
382 account (see next item). However, the user must still supply a password.
383 This feature is intended as a compromise between a fully anonymous account
384 and a fully privileged account. The account should also be set up as for an
385 anonymous account.
386 .It
387 If the user name is
388 .Dq anonymous
389 or
390 .Dq ftp ,
391 an
392 anonymous ftp account must be present in the password
393 file (user
394 .Dq ftp ) .
395 In this case the user is allowed
396 to log in by specifying any password (by convention an email address for
397 the user should be used as the password).
398 .El
399 .Pp
400 In the last case,
401 .Nm ftpd
402 takes special measures to restrict the client's access privileges.
403 The server performs a
404 .Xr chroot 2
405 to the home directory of the
406 .Dq ftp
407 user.
408 In order that system security is not breached, it is recommended
409 that the
410 .Dq ftp
411 subtree be constructed with care, following these rules:
412 .Bl -tag -width "~ftp/pub" -offset indent
413 .It Pa ~ftp
414 Make the home directory owned by
415 .Dq root
416 and unwritable by anyone (mode 555).
417 .It Pa ~ftp/bin
418 Make this directory owned by
419 .Dq root
420 and unwritable by anyone (mode 511).
421 .\"This directory is optional unless you have commands you wish
422 .\"the anonymous ftp user to be able to run (the
423 .\".Xr ls 1
424 .\"command exists as a builtin).
425 .\" -- not in the Linux port (yet?)
426 This directory is required, and should contain at least a statically
427 linked copy of
428 .Xr ls 1.
429 Any programs in this directory should be mode 111 (executable only).
430 .It Pa ~ftp/etc
431 Make this directory owned by
432 .Dq root
433 and unwritable by anyone (mode 511).
434 The files
435 .\" pwd.db (see
436 .\" .Xr pwd_mkdb 8 )
437 .Xr passwd 5
438 and
439 .Xr group 5
440 must be present for the
441 .Xr ls
442 command to be able to produce owner names rather than numbers.
443 The password field in
444 .\" .Xr pwd.db
445 .Pa passwd
446 is not used, and should not contain real passwords.
447 The file
448 .Pa motd ,
449 if present, will be printed after a successful login.
450 These files should be mode 444.
451 .It Pa ~ftp/lib
452 Make this directory owned by
453 .Dq root
454 and unwritable by anyone (mode 511).
455 The libraries
456 .Xr ld-linux.so.2
457 and
458 .Xr libc.so.6
459 (or whatever your
460 .Xr ls
461 command is linked to)
462 must be present.
463 In order to read
464 .Xr passwd 5
465 and
466 .Xr group 5 ,
467 the library
468 .Xr libnss_files.so.2
469 is also needed.
470 Note that if you're using a 2.2.* or later Linux kernel,
471 .Xr ld-linux.so.2
472 must be executable as well as readable (555). All other files should be mode
473 444.
474 .It Pa ~ftp/pub
475 Make this directory mode 555 and owned by
476 .Dq root .
477 This is traditionally where publically accessible files are
478 stored for download.
479 .El
480 .Sh FILES
481 .Bl -tag -width /etc/ftpwelcome -compact
482 .It Pa /etc/ftpusers
483 List of unwelcome/restricted users.
484 .It Pa /etc/ftpchroot
485 List of normal users who should be chroot'd.
486 .It Pa /etc/ftpwelcome
487 Welcome notice.
488 .It Pa /etc/motd
489 Welcome notice after login.
490 .It Pa /etc/nologin
491 Displayed and access refused.
492 .It Pa /var/run/utmp
493 List of users on the system.
494 .It Pa /var/log/ftpd
495 Log file for anonymous transfers.
496 .It Pa /etc/ftpd-ssl/ftpd.pem
497 Default certificate and key for SSL authentication.
498 .It Pa /etc/ssl.users
499 List of trusted users and their subject identifiers.
500 .El
501 .Sh ENVIRONMENT
502 .Nm Ftpd
503 accesses a single environment variable:
504 .Bl -tag -width Fl
505 .It Ev SSL_CIPHER
506 containing a list of acceptable cipher combinations.
507 .El
508 .Sh SEE ALSO
509 .Xr ftp 1 ,
510 .Xr skey 1 ,
511 .Xr who 1 ,
512 .Xr getusershell 3 ,
513 .Xr ftpusers 5 ,
514 .Xr syslogd 8
515 .Sh BUGS
516 The server must run as the super-user
517 to create sockets with privileged port numbers. It maintains
518 an effective user ID of the logged in user, reverting to
519 the super-user only when binding addresses to sockets. The
520 possible security holes have been extensively
521 scrutinized, but are possibly incomplete.
522 .Sh HISTORY
523 The
524 .Nm
525 command appeared in
526 .Bx 4.2 .