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