Initial import from FreeBSD RELENG_4:
[dragonfly.git] / crypto / heimdal / appl / ftp / ftpd / ftpd.8
1 .\"     $NetBSD: ftpd.8,v 1.7 1995/04/11 02:44:53 cgd Exp $
2 .\"
3 .\" Copyright (c) 1985, 1988, 1991, 1993
4 .\"     The Regents of the University of California.  All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\"    must display the following acknowledgement:
16 .\"     This product includes software developed by the University of
17 .\"     California, Berkeley and its contributors.
18 .\" 4. Neither the name of the University nor the names of its contributors
19 .\"    may be used to endorse or promote products derived from this software
20 .\"    without specific prior written permission.
21 .\"
22 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" SUCH DAMAGE.
33 .\"
34 .\"     @(#)ftpd.8      8.2 (Berkeley) 4/19/94
35 .\"
36 .Dd April 19, 1997
37 .Dt FTPD 8
38 .Os BSD 4.2
39 .Sh NAME
40 .Nm ftpd
41 .Nd Internet File Transfer Protocol server
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl a Ar authmode
45 .Op Fl dilvU
46 .Op Fl g Ar umask
47 .Op Fl p Ar port
48 .Op Fl T Ar maxtimeout
49 .Op Fl t Ar timeout
50 .Op Fl u Ar default umask
51 .Op Fl B | Fl -builtin-ls
52 .Op Fl -good-chars= Ns Ar string
53 .Sh DESCRIPTION
54 .Nm Ftpd
55 is the
56 Internet File Transfer Protocol
57 server process.  The server uses the
58 .Tn TCP
59 protocol
60 and listens at the port specified in the
61 .Dq ftp
62 service specification; see
63 .Xr services 5 .
64 .Pp
65 Available options:
66 .Bl -tag -width Ds
67 .It Fl a
68 Select the level of authentication required.  Kerberised login can not
69 be turned off. The default is to only allow kerberised login.  Other
70 possibilities can be turned on by giving a string of comma separated
71 flags as argument to
72 .Fl a .
73 Recognised flags are:
74 .Bl -tag -width plain
75 .It Ar plain
76 Allow logging in with plaintext password. The password can be a(n) OTP
77 or an ordinary password.
78 .It Ar otp
79 Same as
80 .Ar plain ,
81 but only OTP is allowed.
82 .It Ar ftp
83 Allow anonymous login.
84 .El
85 .Pp
86 The following combination modes exists for backwards compatibility:
87 .Bl -tag -width plain
88 .It Ar none
89 Same as
90 .Ar plain,ftp .
91 .It Ar safe
92 Same as
93 .Ar ftp .
94 .It Ar user
95 Ignored.
96 .El
97 .It Fl d
98 Debugging information is written to the syslog using LOG_FTP.
99 .It Fl g
100 Anonymous users will get a umask of
101 .Ar umask .
102 .It Fl i
103 Open a socket and wait for a connection. This is mainly used for
104 debugging when ftpd isn't started by inetd.
105 .It Fl l
106 Each successful and failed
107 .Xr ftp 1
108 session is logged using syslog with a facility of LOG_FTP.
109 If this option is specified twice, the retrieve (get), store (put), append,
110 delete, make directory, remove directory and rename operations and
111 their filename arguments are also logged.
112 .It Fl p
113 Use
114 .Ar port
115 (a service name or number) instead of the default
116 .Ar ftp/tcp .
117 .It Fl T
118 A client may also request a different timeout period;
119 the maximum period allowed may be set to
120 .Ar timeout
121 seconds with the
122 .Fl T
123 option.
124 The default limit is 2 hours.
125 .It Fl t
126 The inactivity timeout period is set to
127 .Ar timeout
128 seconds (the default is 15 minutes).
129 .It Fl u
130 Set the initial umask to something else than the default 027.
131 .It Fl U
132 In previous versions of
133 .Nm ftpd ,
134 when a passive mode client requested a data connection to the server, the
135 server would use data ports in the range 1024..4999.  Now, by default,
136 if the system supports the IP_PORTRANGE socket option, the server will
137 use data ports in the range 49152..65535.  Specifying this option will
138 revert to the old behavior.
139 .It Fl v
140 Verbose mode.
141 .It Xo
142 .Fl B ,
143 .Fl -builtin-ls
144 .Xc
145 use built-in ls to list files
146 .It Xo
147 .Fl -good-chars= Ns Ar string
148 .Xc
149 allowed anonymous upload filename chars
150 .El
151 .Pp
152 The file
153 .Pa /etc/nologin
154 can be used to disable ftp access.
155 If the file exists,
156 .Nm
157 displays it and exits.
158 If the file
159 .Pa /etc/ftpwelcome
160 exists,
161 .Nm
162 prints it before issuing the
163 .Dq ready
164 message.
165 If the file
166 .Pa /etc/motd
167 exists,
168 .Nm
169 prints it after a successful login.
170 .Pp
171 The ftp server currently supports the following ftp requests.
172 The case of the requests is ignored.
173 .Bl -column "Request" -offset indent
174 .It Request Ta "Description"
175 .It ABOR Ta "abort previous command"
176 .It ACCT Ta "specify account (ignored)"
177 .It ALLO Ta "allocate storage (vacuously)"
178 .It APPE Ta "append to a file"
179 .It CDUP Ta "change to parent of current working directory"
180 .It CWD Ta "change working directory"
181 .It DELE Ta "delete a file"
182 .It HELP Ta "give help information"
183 .It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA"
184 .It MKD Ta "make a directory"
185 .It MDTM Ta "show last modification time of file"
186 .It MODE Ta "specify data transfer" Em mode
187 .It NLST Ta "give name list of files in directory"
188 .It NOOP Ta "do nothing"
189 .It PASS Ta "specify password"
190 .It PASV Ta "prepare for server-to-server transfer"
191 .It PORT Ta "specify data connection port"
192 .It PWD Ta "print the current working directory"
193 .It QUIT Ta "terminate session"
194 .It REST Ta "restart incomplete transfer"
195 .It RETR Ta "retrieve a file"
196 .It RMD Ta "remove a directory"
197 .It RNFR Ta "specify rename-from file name"
198 .It RNTO Ta "specify rename-to file name"
199 .It SITE Ta "non-standard commands (see next section)"
200 .It SIZE Ta "return size of file"
201 .It STAT Ta "return status of server"
202 .It STOR Ta "store a file"
203 .It STOU Ta "store a file with a unique name"
204 .It STRU Ta "specify data transfer" Em structure
205 .It SYST Ta "show operating system type of server system"
206 .It TYPE Ta "specify data transfer" Em type
207 .It USER Ta "specify user name"
208 .It XCUP Ta "change to parent of current working directory (deprecated)"
209 .It XCWD Ta "change working directory (deprecated)"
210 .It XMKD Ta "make a directory (deprecated)"
211 .It XPWD Ta "print the current working directory (deprecated)"
212 .It XRMD Ta "remove a directory (deprecated)"
213 .El
214 .Pp
215 The following commands are specified by RFC2228.
216 .Bl -column Request -offset indent
217 .It AUTH Ta "authentication/security mechanism"
218 .It ADAT Ta "authentication/security data"
219 .It PROT Ta "data channel protection level"
220 .It PBSZ Ta "protection buffer size"
221 .It MIC Ta "integrity protected command"
222 .It CONF Ta "confidentiality protected command"
223 .It ENC Ta "privacy protected command"
224 .It CCC Ta "clear command channel"
225 .El
226 .Pp
227 The following non-standard or
228 .Tn UNIX
229 specific commands are supported
230 by the
231 SITE request.
232 .Pp
233 .Bl -column Request -offset indent
234 .It UMASK Ta change umask, (e.g.
235 .Ic "SITE UMASK 002" )
236 .It IDLE Ta set idle-timer, (e.g.
237 .Ic "SITE IDLE 60" )
238 .It CHMOD Ta change mode of a file (e.g.
239 .Ic "SITE CHMOD 755 filename" )
240 .It FIND Ta quickly find a specific file with GNU
241 .Xr locate 1 .
242 .It HELP Ta give help information.
243 .El
244 .Pp
245 The following Kerberos related site commands are understood.
246 .Bl -column Request -offset indent
247 .It KAUTH Ta obtain remote tickets.
248 .It KLIST Ta show remote tickets
249 .El
250 .Pp
251 The remaining ftp requests specified in Internet RFC 959
252 are
253 recognized, but not implemented.
254 MDTM and SIZE are not specified in RFC 959, but will appear in the
255 next updated FTP RFC.
256 .Pp
257 The ftp server will abort an active file transfer only when the
258 ABOR
259 command is preceded by a Telnet "Interrupt Process" (IP)
260 signal and a Telnet "Synch" signal in the command Telnet stream,
261 as described in Internet RFC 959.
262 If a
263 STAT
264 command is received during a data transfer, preceded by a Telnet IP
265 and Synch, transfer status will be returned.
266 .Pp
267 .Nm Ftpd
268 interprets file names according to the
269 .Dq globbing
270 conventions used by
271 .Xr csh 1 .
272 This allows users to utilize the metacharacters
273 .Dq Li \&*?[]{}~ .
274 .Pp
275 .Nm Ftpd
276 authenticates users according to these rules.
277 .Pp
278 .Bl -enum -offset indent
279 .It
280 If Kerberos authentication is used, the user must pass valid tickets
281 and the principal must be allowed to login as the remote user.
282 .It
283 The login name must be in the password data base, and not have a null
284 password (if kerberos is used the password field is not checked).  In
285 this case a password must be provided by the client before any file
286 operations may be performed.  If the user has an OTP key, the response
287 from a successful USER command will include an OTP challenge. The
288 client may choose to respond with a PASS command giving either a
289 standard password or an OTP one-time password. The server will
290 automatically determine which type of password it has been given and
291 attempt to authenticate accordingly. See
292 .Xr otp 1
293 for more information on OTP authentication.
294 .It
295 The login name must not appear in the file
296 .Pa /etc/ftpusers .
297 .It
298 The user must have a standard shell returned by
299 .Xr getusershell 3 .
300 .It
301 If the user name appears in the file
302 .Pa /etc/ftpchroot
303 the session's root will be changed to the user's login directory by
304 .Xr chroot 2
305 as for an
306 .Dq anonymous
307 or
308 .Dq ftp
309 account (see next item).  However, the user must still supply a password.
310 This feature is intended as a compromise between a fully anonymous account
311 and a fully privileged account.  The account should also be set up as for an
312 anonymous account.
313 .It
314 If the user name is
315 .Dq anonymous
316 or
317 .Dq ftp ,
318 an
319 anonymous ftp account must be present in the password
320 file (user
321 .Dq ftp ) .
322 In this case the user is allowed
323 to log in by specifying any password (by convention an email address for
324 the user should be used as the password).
325 .El
326 .Pp
327 In the last case,
328 .Nm ftpd
329 takes special measures to restrict the client's access privileges.
330 The server performs a
331 .Xr chroot 2
332 to the home directory of the
333 .Dq ftp
334 user.
335 In order that system security is not breached, it is recommended
336 that the
337 .Dq ftp
338 subtree be constructed with care, consider following these guidelines
339 for anonymous ftp.
340 .Pp
341 In general all files should be owned by
342 .Dq root ,
343 and have non-write permissions (644 or 755 depending on the kind of
344 file). No files should be owned or writable by
345 .Dq ftp
346 (possibly with exception for the
347 .Pa ~ftp/incoming ,
348 as specified below).
349 .Bl -tag -width "~ftp/pub" -offset indent
350 .It Pa ~ftp
351 The
352 .Dq ftp
353 homedirectory should be owned by root.
354 .It Pa ~ftp/bin
355 The directory for external programs (such as
356 .Xr ls 1 ) .
357 These programs must either be statically linked, or you must setup an
358 environment for dynamic linking when running chrooted.
359 These programs will be used if present:
360 .Bl -tag -width "locate" -offset indent
361 .It ls
362 Used when listing files.
363 .It compress
364 When retrieving a filename that ends in
365 .Pa .Z ,
366 and that file isn't present,
367 .Nm
368 will try to find the filename without
369 .Pa .Z
370 and compress it on the fly.
371 .It gzip
372 Same as compress, just with files ending in
373 .Pa .gz .
374 .It gtar
375 Enables retrieval of whole directories as files ending in
376 .Pa .tar .
377 Can also be combined with compression. You must use GNU Tar (or some
378 other that supports the
379 .Fl z
380 and
381 .Fl Z
382 flags).
383 .It locate
384 Will enable ``fast find'' with the
385 .Ic SITE FIND
386 command. You must also create a
387 .Pa locatedb
388 file in
389 .Pa ~ftp/etc .
390 .El
391 .It Pa ~ftp/etc
392 If you put copies of the
393 .Xr passwd 5
394 and
395 .Xr group 5
396 files here, ls will be able to produce owner names rather than
397 numbers. Remember to remove any passwords from these files.
398 .Pp
399 The file
400 .Pa motd ,
401 if present, will be printed after a successful login.
402 .It Pa ~ftp/dev
403 Put a copy of
404 .Xr /dev/null 7
405 here.
406 .It Pa ~ftp/pub
407 Traditional place to put whatever you want to make public.
408 .El
409 .Pp
410 If you want guests to be able to upload files, create a
411 .Pa ~ftp/incoming
412 directory owned by
413 .Dq root ,
414 and group
415 .Dq ftp
416 with mode 730 (make sure
417 .Dq ftp
418 is member of group
419 .Dq ftp ) .
420 The following restrictions apply to anonymous users:
421 .Bl -bullet
422 .It
423 Directories created will have mode 700.
424 .It
425 Uploaded files will be created with an umask of 777, if not changed
426 with the
427 .Fl g
428 option.
429 .It
430 These command are not accessible:
431 .Ic DELE , RMD , RNTO , RNFR ,
432 .Ic SITE UMASK ,
433 and
434 .Ic SITE CHMOD .
435 .It
436 Filenames must start with an alpha-numeric character, and consist of
437 alpha-numeric characters or any of the following:
438 .Li \&+
439 (plus),
440 .Li \&-
441 (minus),
442 .Li \&=
443 (equal),
444 .Li \&_
445 (underscore),
446 .Li \&.
447 (period), and
448 .Li \&,
449 (comma).
450 .El
451 .Sh FILES
452 .Bl -tag -width /etc/ftpwelcome -compact
453 .It Pa /etc/ftpusers
454 Access list for users.
455 .It Pa /etc/ftpchroot
456 List of normal users who should be chroot'd.
457 .It Pa /etc/ftpwelcome
458 Welcome notice.
459 .It Pa /etc/motd
460 Welcome notice after login.
461 .It Pa /etc/nologin
462 Displayed and access refused.
463 .It Pa ~/.klogin
464 Login access for Kerberos.
465 .El
466 .Sh SEE ALSO
467 .Xr ftp 1 ,
468 .Xr otp 1 ,
469 .Xr getusershell 3 ,
470 .Xr ftpusers 5 ,
471 .Xr syslogd 8
472 .Sh STANDARDS
473 .Bl -tag -compact -width "RFC 1938"
474 .It Cm RFC 959
475 FTP PROTOCOL SPECIFICATION
476 .It Cm RFC 1938
477 OTP Specification
478 .It Cm RFC 2228
479 FTP Security Extensions.
480 .El
481 .Sh BUGS
482 The server must run as the super-user
483 to create sockets with privileged port numbers.  It maintains
484 an effective user id of the logged in user, reverting to
485 the super-user only when binding addresses to sockets.  The
486 possible security holes have been extensively
487 scrutinized, but are possibly incomplete.
488 .Sh HISTORY
489 The
490 .Nm
491 command appeared in
492 .Bx 4.2 .