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