]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/lukemftpd/src/ftpd.8
This commit was generated by cvs2svn to compensate for changes in r160157,
[FreeBSD/FreeBSD.git] / contrib / lukemftpd / src / ftpd.8
1 .\"     $NetBSD: ftpd.8,v 1.74 2003-08-07 09:46:39 agc Exp $
2 .\"
3 .\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Luke Mewburn.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\" 3. All advertising materials mentioning features or use of this software
18 .\"    must display the following acknowledgement:
19 .\"        This product includes software developed by the NetBSD
20 .\"        Foundation, Inc. and its contributors.
21 .\" 4. Neither the name of The NetBSD Foundation nor the names of its
22 .\"    contributors may be used to endorse or promote products derived
23 .\"    from this software without specific prior written permission.
24 .\"
25 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 .\" POSSIBILITY OF SUCH DAMAGE.
36 .\"
37 .\" Copyright (c) 1985, 1988, 1991, 1993
38 .\"     The Regents of the University of California.  All rights reserved.
39 .\"
40 .\" Redistribution and use in source and binary forms, with or without
41 .\" modification, are permitted provided that the following conditions
42 .\" are met:
43 .\" 1. Redistributions of source code must retain the above copyright
44 .\"    notice, this list of conditions and the following disclaimer.
45 .\" 2. Redistributions in binary form must reproduce the above copyright
46 .\"    notice, this list of conditions and the following disclaimer in the
47 .\"    documentation and/or other materials provided with the distribution.
48 .\" 3. Neither the name of the University nor the names of its contributors
49 .\"    may be used to endorse or promote products derived from this software
50 .\"    without specific prior written permission.
51 .\"
52 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 .\" SUCH DAMAGE.
63 .\"
64 .\"     @(#)ftpd.8      8.2 (Berkeley) 4/19/94
65 .\"
66 .Dd February 26, 2003
67 .Dt FTPD 8
68 .Os
69 .Sh NAME
70 .Nm ftpd
71 .Nd
72 Internet File Transfer Protocol server
73 .Sh SYNOPSIS
74 .Nm
75 .Op Fl dHlqQrsuUwWX
76 .Op Fl a Ar anondir
77 .Op Fl c Ar confdir
78 .Op Fl C Ar user
79 .Op Fl e Ar emailaddr
80 .Op Fl h Ar hostname
81 .Op Fl L Ar xferlogfile
82 .Op Fl P Ar dataport
83 .Op Fl V Ar version
84 .Sh DESCRIPTION
85 .Nm
86 is the Internet File Transfer Protocol server process.
87 The server uses the
88 .Tn TCP
89 protocol and listens at the port specified in the
90 .Dq ftp
91 service specification; see
92 .Xr services 5 .
93 .Pp
94 Available options:
95 .Bl -tag -width Ds
96 .It Fl a Ar anondir
97 Define
98 .Ar anondir
99 as the directory to
100 .Xr chroot 2
101 into for anonymous logins.
102 Default is the home directory for the ftp user.
103 This can also be specified with the
104 .Xr ftpd.conf 5
105 .Sy chroot
106 directive.
107 .It Fl c Ar confdir
108 Change the root directory of the configuration files from
109 .Dq Pa /etc
110 to
111 .Ar confdir .
112 This changes the directory for the following files:
113 .Pa /etc/ftpchroot ,
114 .Pa /etc/ftpusers ,
115 .Pa /etc/ftpwelcome ,
116 .Pa /etc/motd ,
117 and the file specified by the
118 .Xr ftpd.conf 5
119 .Sy limit
120 directive.
121 .It Fl C Ar user
122 Check whether
123 .Ar user
124 would be granted access under
125 the restrictions given in
126 .Xr ftpusers 5
127 and exit without attempting a connection.
128 .Nm
129 exits with an exit code of 0 if access would be granted, or 1 otherwise.
130 This can be useful for testing configurations.
131 .It Fl d
132 Debugging information is written to the syslog using a facility of
133 .Dv LOG_FTP .
134 .It Fl e Ar emailaddr
135 Use
136 .Ar emailaddr
137 for the
138 .Dq "\&%E"
139 escape sequence (see
140 .Sx Display file escape sequences )
141 .It Fl h Ar hostname
142 Explicitly set the hostname to advertise as to
143 .Ar hostname .
144 The default is the hostname associated with the IP address that
145 .Nm
146 is listening on.
147 This ability (with or without
148 .Fl h ) ,
149 in conjunction with
150 .Fl c Ar confdir ,
151 is useful when configuring
152 .Sq virtual
153 .Tn FTP
154 servers, each listening on separate addresses as separate names.
155 Refer to
156 .Xr inetd.conf 5
157 for more information on starting services to listen on specific IP addresses.
158 .It Fl H
159 Equivalent to
160 .Do
161 -h
162 `hostname`
163 .Dc .
164 .It Fl l
165 Each successful and failed
166 .Tn FTP
167 session is logged using syslog with a facility of
168 .Dv LOG_FTP .
169 If this option is specified more than once, the retrieve (get), store (put),
170 append, delete, make directory, remove directory and rename operations and
171 their file name arguments are also logged.
172 .It Fl L Ar xferlogfile
173 Log
174 .Tn wu-ftpd
175 style
176 .Sq xferlog
177 entries to
178 .Ar xferlogfile .
179 .It Fl P Ar dataport
180 Use
181 .Ar dataport
182 as the data port, overriding the default of using the port one less
183 that the port
184 .Nm
185 is listening on.
186 .It Fl q
187 Enable the use of pid files for keeping track of the number of logged-in
188 users per class.
189 This is the default.
190 .It Fl Q
191 Disable the use of pid files for keeping track of the number of logged-in
192 users per class.
193 This may reduce the load on heavily loaded
194 .Tn FTP
195 servers.
196 .It Fl r
197 Permanently drop root privileges once the user is logged in.
198 The use of this option may result in the server using a port other
199 than the (listening-port - 1) for
200 .Sy PORT
201 style commands, which is contrary to the
202 .Cm RFC 959
203 specification, but in practice very few clients rely upon this behaviour.
204 See
205 .Sx SECURITY CONSIDERATIONS
206 below for more details.
207 .It Fl s
208 Require a secure authentication mechanism like Kerberos or S/Key to be used.
209 .It Fl u
210 Log each concurrent
211 .Tn FTP
212 session to
213 .Pa /var/run/utmp ,
214 making them visible to commands such as
215 .Xr who 1 .
216 .It Fl U
217 Don't log each concurrent
218 .Tn FTP
219 session to
220 .Pa /var/run/utmp .
221 This is the default.
222 .It Fl V Ar version
223 Use
224 .Ar version
225 as the version to advertise in the login banner and in the output of
226 .Sy STAT
227 and
228 .Sy SYST
229 instead of the default version information.
230 If
231 .Ar version
232 is empty or
233 .Sq -
234 then don't display any version information.
235 .It Fl w
236 Log each
237 .Tn FTP
238 session to
239 .Pa /var/log/wtmp ,
240 making them visible to commands such as
241 .Xr last 1 .
242 This is the default.
243 .It Fl W
244 Don't log each
245 .Tn FTP
246 session to
247 .Pa /var/log/wtmp .
248 .It Fl X
249 Log
250 .Tn wu-ftpd
251 style
252 .Sq xferlog
253 entries to the syslog, prefixed with
254 .Dq "xferlog:\ " ,
255 using a facility of
256 .Dv LOG_FTP .
257 These syslog entries can be converted to a
258 .Tn wu-ftpd
259 style
260 .Pa xferlog
261 file suitable for input into a third-party log analysis tool with a command
262 similar to:
263 .Dl "grep 'xferlog: ' /var/log/xferlog | \e"
264 .Dl "\ \ \ sed -e 's/^.*xferlog: //' \*[Gt] wuxferlog"
265 .El
266 .Pp
267 The file
268 .Pa /etc/nologin
269 can be used to disable
270 .Tn FTP
271 access.
272 If the file exists,
273 .Nm
274 displays it and exits.
275 If the file
276 .Pa /etc/ftpwelcome
277 exists,
278 .Nm
279 prints it before issuing the
280 .Dq ready
281 message.
282 If the file
283 .Pa /etc/motd
284 exists (under the chroot directory if applicable),
285 .Nm
286 prints it after a successful login.
287 This may be changed with the
288 .Xr ftpd.conf 5
289 directive
290 .Sy motd .
291 .Pp
292 The
293 .Nm
294 server currently supports the following
295 .Tn FTP
296 requests.
297 The case of the requests is ignored.
298 .Bl -column "Request" -offset indent
299 .It Sy Request Ta Sy Description
300 .It ABOR Ta "abort previous command"
301 .It ACCT Ta "specify account (ignored)"
302 .It ALLO Ta "allocate storage (vacuously)"
303 .It APPE Ta "append to a file"
304 .It CDUP Ta "change to parent of current working directory"
305 .It CWD Ta "change working directory"
306 .It DELE Ta "delete a file"
307 .It EPSV Ta "prepare for server-to-server transfer"
308 .It EPRT Ta "specify data connection port"
309 .It FEAT Ta "list extra features that are not defined in" Cm "RFC 959"
310 .It HELP Ta "give help information"
311 .It LIST Ta "give list files in a directory" Pq Dq Li "ls -lA"
312 .It LPSV Ta "prepare for server-to-server transfer"
313 .It LPRT Ta "specify data connection port"
314 .It MLSD Ta "list contents of directory in a machine-processable form"
315 .It MLST Ta "show a pathname in a machine-processable form"
316 .It MKD Ta "make a directory"
317 .It MDTM Ta "show last modification time of file"
318 .It MODE Ta "specify data transfer" Em mode
319 .It NLST Ta "give name list of files in directory"
320 .It NOOP Ta "do nothing"
321 .It OPTS Ta "define persistent options for a given command"
322 .It PASS Ta "specify password"
323 .It PASV Ta "prepare for server-to-server transfer"
324 .It PORT Ta "specify data connection port"
325 .It PWD Ta "print the current working directory"
326 .It QUIT Ta "terminate session"
327 .It REST Ta "restart incomplete transfer"
328 .It RETR Ta "retrieve a file"
329 .It RMD Ta "remove a directory"
330 .It RNFR Ta "specify rename-from file name"
331 .It RNTO Ta "specify rename-to file name"
332 .It SITE Ta "non-standard commands (see next section)"
333 .It SIZE Ta "return size of file"
334 .It STAT Ta "return status of server"
335 .It STOR Ta "store a file"
336 .It STOU Ta "store a file with a unique name"
337 .It STRU Ta "specify data transfer" Em structure
338 .It SYST Ta "show operating system type of server system"
339 .It TYPE Ta "specify data transfer" Em type
340 .It USER Ta "specify user name"
341 .It XCUP Ta "change to parent of current working directory (deprecated)"
342 .It XCWD Ta "change working directory (deprecated)"
343 .It XMKD Ta "make a directory (deprecated)"
344 .It XPWD Ta "print the current working directory (deprecated)"
345 .It XRMD Ta "remove a directory (deprecated)"
346 .El
347 .Pp
348 The following non-standard or
349 .Ux
350 specific commands are supported by the SITE request.
351 .Pp
352 .Bl -column Request -offset indent
353 .It Sy Request Ta Sy Description
354 .It CHMOD Ta "change mode of a file, e.g. ``SITE CHMOD 755 filename''"
355 .It HELP Ta "give help information."
356 .It IDLE Ta "set idle-timer, e.g. ``SITE IDLE 60''"
357 .It RATEGET Ta "set maximum get rate throttle in bytes/second, e.g. ``SITE RATEGET 5k''"
358 .It RATEPUT Ta "set maximum put rate throttle in bytes/second, e.g. ``SITE RATEPUT 5k''"
359 .It UMASK Ta "change umask, e.g. ``SITE UMASK 002''"
360 .El
361 .Pp
362 The following
363 .Tn FTP
364 requests (as specified in
365 .Cm RFC 959 )
366 are recognized, but are not implemented:
367 .Sy ACCT ,
368 .Sy SMNT ,
369 and
370 .Sy REIN .
371 .Sy MDTM
372 and
373 .Sy SIZE
374 are not specified in
375 .Cm RFC 959 ,
376 but will appear in the
377 next updated
378 .Tn FTP
379 RFC.
380 .Pp
381 The
382 .Nm
383 server will abort an active file transfer only when the
384 .Sy ABOR
385 command is preceded by a Telnet "Interrupt Process" (IP)
386 signal and a Telnet "Synch" signal in the command Telnet stream,
387 as described in Internet
388 .Cm RFC 959 .
389 If a
390 .Sy STAT
391 command is received during a data transfer, preceded by a Telnet IP
392 and Synch, transfer status will be returned.
393 .Pp
394 .Nm
395 interprets file names according to the
396 .Dq globbing
397 conventions used by
398 .Xr csh 1 .
399 This allows users to use the metacharacters
400 .Dq Li \&*?[]{}~ .
401 .Ss User authentication
402 .Nm
403 authenticates users according to five rules.
404 .Pp
405 .Bl -enum -offset indent
406 .It
407 The login name must be in the password data base,
408 .Pa /etc/pwd.db ,
409 and not have a null password.
410 In this case a password must be provided by the client before any
411 file operations may be performed.
412 If the user has an S/Key key, the response from a successful
413 .Sy USER
414 command will include an S/Key challenge.
415 The client may choose to respond with a
416 .Sy PASS
417 command giving either
418 a standard password or an S/Key one-time password.
419 The server will automatically determine which type of password it
420 has been given and attempt to authenticate accordingly.
421 See
422 .Xr skey 1
423 for more information on S/Key authentication.
424 S/Key is a Trademark of Bellcore.
425 .It
426 The login name must be allowed based on the information in
427 .Xr ftpusers 5 .
428 .It
429 The user must have a standard shell returned by
430 .Xr getusershell 3 .
431 If the user's shell field in the password database is empty, the
432 shell is assumed to be
433 .Pa /bin/sh .
434 As per
435 .Xr shells 5 ,
436 the user's shell must be listed with full path in
437 .Pa /etc/shells .
438 .It
439 If directed by the file
440 .Xr ftpchroot 5
441 the session's root directory will be changed by
442 .Xr chroot 2
443 to the directory specified in the
444 .Xr ftpd.conf 5
445 .Sy chroot
446 directive (if set),
447 or to the home directory of the user.
448 However, the user must still supply a password.
449 This feature is intended as a compromise between a fully anonymous account
450 and a fully privileged account.
451 The account should also be set up as for an anonymous account.
452 .It
453 If the user name is
454 .Dq anonymous
455 or
456 .Dq ftp ,
457 an
458 anonymous
459 .Tn FTP
460 account must be present in the password
461 file (user
462 .Dq ftp ) .
463 In this case the user is allowed
464 to log in by specifying any password (by convention an email address for
465 the user should be used as the password).
466 .Pp
467 The server performs a
468 .Xr chroot 2
469 to the directory specified in the
470 .Xr ftpd.conf 5
471 .Sy chroot
472 directive (if set),
473 the
474 .Fl a Ar anondir
475 directory (if set),
476 or to the home directory of the
477 .Dq ftp
478 user.
479 .Pp
480 The server then performs a
481 .Xr chdir 2
482 to the directory specified in the
483 .Xr ftpd.conf 5
484 .Sy homedir
485 directive (if set), otherwise to
486 .Pa / .
487 .Pp
488 If other restrictions are required (such as disabling of certain
489 commands and the setting of a specific umask), then appropriate
490 entries in
491 .Xr ftpd.conf 5
492 are required.
493 .Pp
494 If the first character of the password supplied by an anonymous user
495 is
496 .Dq - ,
497 then the verbose messages displayed at login and upon a
498 .Sy CWD
499 command are suppressed.
500 .El
501 .Ss Display file escape sequences
502 When
503 .Nm
504 displays various files back to the client (such as
505 .Pa /etc/ftpwelcome
506 and
507 .Pa /etc/motd ) ,
508 various escape strings are replaced with information pertinent
509 to the current connection.
510 .Pp
511 The supported escape strings are:
512 .Bl -tag -width "Escape" -offset indent -compact
513 .It Sy "Escape"
514 .Sy Description
515 .It "\&%c"
516 Class name.
517 .It "\&%C"
518 Current working directory.
519 .It "\&%E"
520 Email address given with
521 .Fl e .
522 .It "\&%L"
523 Local hostname.
524 .It "\&%M"
525 Maximum number of users for this class.
526 Displays
527 .Dq unlimited
528 if there's no limit.
529 .It "\&%N"
530 Current number of users for this class.
531 .It "\&%R"
532 Remote hostname.
533 .It "\&%s"
534 If the result of the most recent
535 .Dq "\&%M"
536 or
537 .Dq "\&%N"
538 was not
539 .Dq Li 1 ,
540 print an
541 .Dq s .
542 .It "\&%S"
543 If the result of the most recent
544 .Dq "\&%M"
545 or
546 .Dq "\&%N"
547 was not
548 .Dq Li 1 ,
549 print an
550 .Dq S .
551 .It "\&%T"
552 Current time.
553 .It "\&%U"
554 User name.
555 .It "\&%\&%"
556 A
557 .Dq \&%
558 character.
559 .El
560 .Ss Setting up a restricted ftp subtree
561 In order that system security is not breached, it is recommended
562 that the
563 subtrees for the
564 .Dq ftp
565 and
566 .Dq chroot
567 accounts be constructed with care, following these rules
568 (replace
569 .Dq ftp
570 in the following directory names
571 with the appropriate account name for
572 .Sq chroot
573 users):
574 .Bl -tag -width "~ftp/incoming" -offset indent
575 .It Pa ~ftp
576 Make the home directory owned by
577 .Dq root
578 and unwritable by anyone.
579 .It Pa ~ftp/bin
580 Make this directory owned by
581 .Dq root
582 and unwritable by anyone (mode 555).
583 Generally any conversion commands should be installed
584 here (mode 111).
585 .It Pa ~ftp/etc
586 Make this directory owned by
587 .Dq root
588 and unwritable by anyone (mode 555).
589 The files
590 .Pa pwd.db
591 (see
592 .Xr passwd 5 )
593 and
594 .Pa group
595 (see
596 .Xr group 5 )
597 must be present for the
598 .Sy LIST
599 command to be able to display owner and group names instead of numbers.
600 The password field in
601 .Xr passwd 5
602 is not used, and should not contain real passwords.
603 The file
604 .Pa motd ,
605 if present, will be printed after a successful login.
606 These files should be mode 444.
607 .It Pa ~ftp/pub
608 This directory and the subdirectories beneath it should be owned
609 by the users and groups responsible for placing files in them,
610 and be writable only by them (mode 755 or 775).
611 They should
612 .Em not
613 be owned or writable by ftp or its group.
614 .It Pa ~ftp/incoming
615 This directory is where anonymous users place files they upload.
616 The owners should be the user
617 .Dq ftp
618 and an appropriate group.
619 Members of this group will be the only users with access to these
620 files after they have been uploaded; these should be people who
621 know how to deal with them appropriately.
622 If you wish anonymous
623 .Tn FTP
624 users to be able to see the names of the
625 files in this directory the permissions should be 770, otherwise
626 they should be 370.
627 .Pp
628 The following
629 .Xr ftpd.conf 5
630 directives should be used:
631 .Dl "modify guest off"
632 .Dl "umask  guest 0707"
633 .Dl "upload guest on"
634 .Pp
635 This will result in anonymous users being able to upload files to this
636 directory, but they will not be able to download them, delete them, or
637 overwrite them, due to the umask and disabling of the commands mentioned
638 above.
639 .It Pa ~ftp/tmp
640 This directory is used to create temporary files which contain
641 the error messages generated by a conversion or
642 .Sy LIST
643 command.
644 The owner should be the user
645 .Dq ftp .
646 The permissions should be 300.
647 .Pp
648 If you don't enable conversion commands, or don't want anonymous users
649 uploading files here (see
650 .Pa ~ftp/incoming
651 above), then don't create this directory.
652 However, error messages from conversion or
653 .Sy LIST
654 commands won't be returned to the user.
655 (This is the traditional behaviour.)
656 Note that the
657 .Xr ftpd.conf 5
658 directive
659 .Sy upload
660 can be used to prevent users uploading here.
661 .El
662 .Pp
663 To set up "ftp-only" accounts that provide only
664 .Tn FTP ,
665 but no valid shell
666 login, you can copy/link
667 .Pa /sbin/nologin
668 to
669 .Pa /sbin/ftplogin ,
670 and enter
671 .Pa /sbin/ftplogin
672 to
673 .Pa /etc/shells
674 to allow logging-in via
675 .Tn FTP
676 into the accounts, which must have
677 .Pa /sbin/ftplogin
678 as login shell.
679 .Sh FILES
680 .Bl -tag -width /etc/ftpwelcome -compact
681 .It Pa /etc/ftpchroot
682 List of normal users whose root directory should be changed via
683 .Xr chroot 2 .
684 .It Pa /etc/ftpd.conf
685 Configure file conversions and other settings.
686 .It Pa /etc/ftpusers
687 List of unwelcome/restricted users.
688 .It Pa /etc/ftpwelcome
689 Welcome notice before login.
690 .It Pa /etc/motd
691 Welcome notice after login.
692 .It Pa /etc/nologin
693 If it exists, displayed and access is refused.
694 .It Pa /var/run/ftpd.pids-CLASS
695 State file of logged-in processes for the
696 .Nm
697 class
698 .Sq CLASS .
699 .It Pa /var/run/utmp
700 List of logged-in users on the system.
701 .It Pa /var/log/wtmp
702 Login history database.
703 .El
704 .Sh SEE ALSO
705 .Xr ftp 1 ,
706 .Xr skey 1 ,
707 .Xr who 1 ,
708 .Xr getusershell 3 ,
709 .Xr ftpchroot 5 ,
710 .Xr ftpd.conf 5 ,
711 .Xr ftpusers 5 ,
712 .Xr syslogd 8
713 .Sh STANDARDS
714 .Nm
715 recognizes all commands in
716 .Cm RFC 959 ,
717 follows the guidelines in
718 .Cm RFC 1123 ,
719 recognizes all commands in
720 .Cm RFC 2228
721 (although they are not supported yet),
722 and supports the extensions from
723 .Cm RFC 2389 ,
724 .Cm RFC 2428
725 and
726 .Cm draft-ietf-ftpext-mlst-11 .
727 .Sh HISTORY
728 The
729 .Nm
730 command appeared in
731 .Bx 4.2 .
732 .Pp
733 Various features such as the
734 .Xr ftpd.conf 5
735 functionality,
736 .Cm RFC 2389 ,
737 and
738 .Cm draft-ietf-ftpext-mlst-11
739 support was implemented in
740 .Nx 1.3
741 and later releases by Luke Mewburn.
742 .Sh BUGS
743 The server must run as the super-user to create sockets with
744 privileged port numbers (i.e, those less than
745 .Dv IPPORT_RESERVED ,
746 which is 1024).
747 If
748 .Nm
749 is listening on a privileged port
750 it maintains an effective user id of the logged in user, reverting
751 to the super-user only when binding addresses to privileged sockets.
752 The
753 .Fl r
754 option can be used to override this behaviour and force privileges to
755 be permanently revoked; see
756 .Sx SECURITY CONSIDERATIONS
757 below for more details.
758 .Pp
759 .Nm
760 may have trouble handling connections from scoped IPv6 addresses, or
761 IPv4 mapped addresses
762 .Po
763 IPv4 connection on
764 .Dv AF_INET6
765 socket
766 .Pc .
767 For the latter case, running two daemons,
768 one for IPv4 and one for IPv6, will avoid the problem.
769 .Sh SECURITY CONSIDERATIONS
770 .Cm RFC 959
771 provides no restrictions on the
772 .Sy PORT
773 command, and this can lead to security problems, as
774 .Nm
775 can be fooled into connecting to any service on any host.
776 With the
777 .Dq checkportcmd
778 feature of the
779 .Xr ftpd.conf 5 ,
780 .Sy PORT
781 commands with different host addresses, or TCP ports lower than
782 .Dv IPPORT_RESERVED
783 will be rejected.
784 This also prevents
785 .Sq third-party proxy ftp
786 from working.
787 Use of this option is
788 .Em strongly
789 recommended, and enabled by default.
790 .Pp
791 By default
792 .Nm
793 uses a port that is one less than the port it is listening on to
794 communicate back to the client for the
795 .Sy EPRT ,
796 .Sy LPRT ,
797 and
798 .Sy PORT
799 commands, unless overridden with
800 .Fl P Ar dataport .
801 As the default port for
802 .Nm
803 (21) is a privileged port below
804 .Dv IPPORT_RESERVED ,
805 .Nm
806 retains the ability to switch back to root privileges to bind these
807 ports.
808 In order to increase security by reducing the potential for a bug in
809 .Nm
810 providing a remote root compromise,
811 .Nm
812 will permanently drop root privileges if one of the following is true:
813 .Bl -enum -offset indent
814 .It
815 .Nm
816 is running on a port greater than
817 .Dv IPPORT_RESERVED
818 and the user has logged in as a
819 .Sq guest
820 or
821 .Sq chroot
822 user.
823 .It
824 .Nm
825 was invoked with
826 .Fl r .
827 .El
828 .Pp
829 Don't create
830 .Pa ~ftp/tmp
831 if you don't want anonymous users to upload files there.
832 That directory is only necessary if you want to display the error
833 messages of conversion commands to the user.
834 Note that if uploads are disabled with the
835 .Xr ftpd.conf 5
836 directive
837 .Sy upload ,
838 then this directory cannot be abused by the user in this way, so it
839 should be safe to create.