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