]> git.saurik.com Git - apple/network_cmds.git/blob - ftpd.tproj/ftpd.8
network_cmds-77.tar.gz
[apple/network_cmds.git] / ftpd.tproj / ftpd.8
1 .\" Copyright (c) 1985, 1988, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94
33 .\" $FreeBSD: src/libexec/ftpd/ftpd.8,v 1.36 2000/12/18 08:33:25 ru Exp $
34 .\"
35 .Dd January 27, 2000
36 .Dt FTPD 8
37 .Os BSD 4.2
38 .Sh NAME
39 .Nm ftpd
40 .Nd
41 Internet File Transfer Protocol server
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl 4
45 .Op Fl 6
46 .Op Fl d
47 .Op Fl l Op Fl l
48 .Op Fl A
49 .Op Fl D
50 .Op Fl R
51 .Op Fl S
52 .Op Fl U
53 .Op Fl r
54 .Op Fl E
55 .Op Fl T Ar maxtimeout
56 .Op Fl t Ar timeout
57 .Op Fl a Ar address
58 .Op Fl p Ar file
59 .Sh DESCRIPTION
60 .Nm Ftpd
61 is the
62 Internet File Transfer Protocol
63 server process. The server uses the
64 .Tn TCP
65 protocol
66 and listens at the port specified in the
67 .Dq ftp
68 service specification; see
69 .Xr services 5 .
70 .Pp
71 Available options:
72 .Bl -tag -width indent
73 .It Fl d
74 Debugging information is written to the syslog using LOG_FTP.
75 .It Fl l
76 Each successful and failed
77 .Xr ftp 1
78 session is logged using syslog with a facility of LOG_FTP.
79 If this option is specified twice, the retrieve (get), store (put), append,
80 delete, make directory, remove directory and rename operations and
81 their filename arguments are also logged. Note: LOG_FTP messages
82 are not displayed by
83 .Xr syslogd 8
84 by default, and may have to be enabled in
85 .Xr syslogd 8 Ns 's
86 configuration file.
87 .It Fl D
88 With this option set,
89 .Nm
90 will detach and become a daemon, accepting connections on the FTP port and
91 forking children processes to handle them.
92 This is lower overhead than starting
93 .Nm
94 from
95 .Xr inetd 8
96 and is thus useful on busy servers to reduce load.
97 .It Fl R
98 With this option set,
99 .Nm
100 will revert to historical behavior with regard to security checks on
101 user operations and restrictions on PORT requests.
102 Currently,
103 .Nm
104 will only honor PORT commands directed to unprivileged ports on the
105 remote user's host (which violates the FTP protocol specification but
106 closes some security holes).
107 .It Fl S
108 With this option set,
109 .Nm
110 logs all anonymous file downloads to the file
111 .Pa /var/log/ftpd
112 when this file exists.
113 .It Fl U
114 In previous versions of
115 .Nm ,
116 when a passive mode client requested a data connection to the server,
117 the server would use data ports in the range 1024..4999. Now, by default,
118 the server will use data ports in the range 49152..65535. Specifying this
119 option will revert to the old behavior.
120 .It Fl T
121 A client may also request a different timeout period;
122 the maximum period allowed may be set to
123 .Ar timeout
124 seconds with the
125 .Fl T
126 option.
127 The default limit is 2 hours.
128 .It Fl t
129 The inactivity timeout period is set to
130 .Ar timeout
131 seconds (the default is 15 minutes).
132 .It Fl a
133 When
134 .Fl D
135 is specified, accept connections only on the specified
136 .Ar address .
137 .It Fl p
138 When
139 .Fl D
140 is specified, write the daemon's process ID to
141 .Ar file .
142 .It Fl 6
143 When
144 .Fl D
145 is specified, accept connections via AF_INET6 socket.
146 .It Fl 4
147 When
148 .Fl D
149 is specified, accept IPv4 connections.
150 When
151 .Fl 6
152 is also specified, accept IPv4 connection via AF_INET6 socket.
153 When
154 .Fl 6
155 is not specified, accept IPv4 connection via AF_INET socket.
156 .It Fl A
157 Allow only anonymous ftp access.
158 .It Fl r
159 Put server in read-only mode.
160 All commands which may modify the local filesystem are disabled.
161 .It Fl E
162 Disable the EPSV command.
163 This is useful for servers behind older firewalls.
164 .El
165 .Pp
166 The file
167 .Pa /var/run/nologin
168 can be used to disable ftp access.
169 If the file exists,
170 .Nm
171 displays it and exits.
172 If the file
173 .Pa /etc/ftpwelcome
174 exists,
175 .Nm
176 prints it before issuing the
177 .Dq ready
178 message.
179 If the file
180 .Pa /etc/ftpmotd
181 exists,
182 .Nm
183 prints it after a successful login. Note the motd file used is the one
184 relative to the login environment. This means the one in
185 .Pa ~ftp/etc
186 in the anonymous user's case.
187 .Pp
188 The ftp server currently supports the following ftp requests.
189 The case of the requests is ignored. Requests marked [RW] are
190 disabled if
191 .Fl r
192 is specified.
193 .Bl -column "Request" -offset indent
194 .It Sy Request Ta Sy "Description"
195 .It ABOR Ta "abort previous command"
196 .It ACCT Ta "specify account (ignored)"
197 .It ALLO Ta "allocate storage (vacuously)"
198 .It APPE Ta "append to a file [RW]"
199 .It CDUP Ta "change to parent of current working directory"
200 .It CWD Ta "change working directory"
201 .It DELE Ta "delete a file [RW]"
202 .It EPRT Ta "specify data connection port, multiprotocol"
203 .It EPSV Ta "prepare for server-to-server transfer, multiprotocol"
204 .It HELP Ta "give help information"
205 .It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA"
206 .It LPRT Ta "specify data connection port, multiprotocol"
207 .It LPSV Ta "prepare for server-to-server transfer, multiprotocol"
208 .It MDTM Ta "show last modification time of file"
209 .It MKD Ta "make a directory [RW]"
210 .It MODE Ta "specify data transfer" Em mode
211 .It NLST Ta "give name list of files in directory"
212 .It NOOP Ta "do nothing"
213 .It PASS Ta "specify password"
214 .It PASV Ta "prepare for server-to-server transfer"
215 .It PORT Ta "specify data connection port"
216 .It PWD Ta "print the current working directory"
217 .It QUIT Ta "terminate session"
218 .It REST Ta "restart incomplete transfer"
219 .It RETR Ta "retrieve a file"
220 .It RMD Ta "remove a directory [RW]"
221 .It RNFR Ta "specify rename-from file name [RW]"
222 .It RNTO Ta "specify rename-to file name [RW]"
223 .It SITE Ta "non-standard commands (see next section)"
224 .It SIZE Ta "return size of file"
225 .It STAT Ta "return status of server"
226 .It STOR Ta "store a file [RW]"
227 .It STOU Ta "store a file with a unique name [RW]"
228 .It STRU Ta "specify data transfer" Em structure
229 .It SYST Ta "show operating system type of server system"
230 .It TYPE Ta "specify data transfer" Em type
231 .It USER Ta "specify user name"
232 .It XCUP Ta "change to parent of current working directory (deprecated)"
233 .It XCWD Ta "change working directory (deprecated)"
234 .It XMKD Ta "make a directory (deprecated) [RW]"
235 .It XPWD Ta "print the current working directory (deprecated)"
236 .It XRMD Ta "remove a directory (deprecated) [RW]"
237 .El
238 .Pp
239 The following non-standard or
240 .Tn UNIX
241 specific commands are supported
242 by the
243 SITE request.
244 .Pp
245 .Bl -column Request -offset indent
246 .It Sy Request Ta Sy Description
247 .It UMASK Ta change umask, e.g. ``SITE UMASK 002''
248 .It IDLE Ta set idle-timer, e.g. ``SITE IDLE 60''
249 .It CHMOD Ta "change mode of a file [RW], e.g. ``SITE CHMOD 755 filename''"
250 .It HELP Ta give help information
251 .El
252 .Pp
253 The remaining ftp requests specified in Internet RFC 959
254 are
255 recognized, but not implemented.
256 MDTM and SIZE are not specified in RFC 959, but will appear in the
257 next updated FTP RFC.
258 .Pp
259 The ftp server will abort an active file transfer only when the
260 ABOR
261 command is preceded by a Telnet "Interrupt Process" (IP)
262 signal and a Telnet "Synch" signal in the command Telnet stream,
263 as described in Internet RFC 959.
264 If a
265 STAT
266 command is received during a data transfer, preceded by a Telnet IP
267 and Synch, transfer status will be returned.
268 .Pp
269 .Nm Ftpd
270 interprets file names according to the
271 .Dq globbing
272 conventions used by
273 .Xr csh 1 .
274 This allows users to utilize the metacharacters
275 .Dq Li \&*?[]{}~ .
276 .Pp
277 .Nm Ftpd
278 authenticates users according to six rules.
279 .Pp
280 .Bl -enum -offset indent
281 .It
282 The login name must be in the password data base
283 and not have a null password.
284 In this case a password must be provided by the client before any
285 file operations may be performed.
286 If the user has an S/Key key, the response from a successful USER
287 command will include an S/Key challenge.
288 The client may choose to respond with a PASS command giving either
289 a standard password or an S/Key one-time password.
290 The server will automatically determine which type of
291 password it has been given and attempt to authenticate accordingly.
292 See
293 .Xr key 1
294 for more information on S/Key authentication.
295 S/Key is a Trademark of Bellcore.
296 .It
297 The login name must not appear in the file
298 .Pa /etc/ftpusers .
299 .It
300 The login name must not be a member of a group specified in the file
301 .Pa /etc/ftpusers .
302 Entries in this file interpreted as group names are prefixed by an "at"
303 .Ql \&@
304 sign.
305 .It
306 The user must have a standard shell returned by
307 .Xr getusershell 3 .
308 .It
309 If the user name appears in the file
310 .Pa /etc/ftpchroot ,
311 or the user is a member of a group with a group entry in this file,
312 i.e. one prefixed with
313 .Ql \&@ ,
314 the session's root will be changed to the user's login directory by
315 .Xr chroot 2
316 as for an
317 .Dq anonymous
318 or
319 .Dq ftp
320 account (see next item).
321 This facility may also be triggered by enabling the boolean "ftp-chroot"
322 capability in
323 .Xr login.conf 5 .
324 However, the user must still supply a password.
325 This feature is intended as a compromise between a fully anonymous
326 account and a fully privileged account.
327 The account should also be set up as for an anonymous account.
328 .It
329 If the user name is
330 .Dq anonymous
331 or
332 .Dq ftp ,
333 an
334 anonymous ftp account must be present in the password
335 file (user
336 .Dq ftp ) .
337 In this case the user is allowed
338 to log in by specifying any password (by convention an email address for
339 the user should be used as the password).
340 When the
341 .Fl S
342 option is set, all transfers are logged as well.
343 .El
344 .Pp
345 In the last case,
346 .Nm
347 takes special measures to restrict the client's access privileges.
348 The server performs a
349 .Xr chroot 2
350 to the home directory of the
351 .Dq ftp
352 user.
353 In order that system security is not breached, it is recommended
354 that the
355 .Dq ftp
356 subtree be constructed with care, following these rules:
357 .Bl -tag -width "~ftp/pub" -offset indent
358 .It Pa ~ftp
359 Make the home directory owned by
360 .Dq root
361 and unwritable by anyone.
362 .It Pa ~ftp/etc
363 Make this directory owned by
364 .Dq root
365 and unwritable by anyone (mode 555).
366 The files pwd.db (see
367 .Xr passwd 5 )
368 and
369 .Xr group 5
370 must be present for the
371 .Xr ls
372 command to be able to produce owner names rather than numbers.
373 The password field in
374 .Xr passwd
375 is not used, and should not contain real passwords.
376 The file
377 .Pa ftpmotd ,
378 if present, will be printed after a successful login.
379 These files should be mode 444.
380 .It Pa ~ftp/pub
381 Make this directory mode 777 and owned by
382 .Dq ftp .
383 Guests
384 can then place files which are to be accessible via the anonymous
385 account in this directory.
386 .El
387 .Pp
388 If the system has multiple IP addresses,
389 .Nm
390 supports the idea of virtual hosts, which provides the ability to
391 define multiple anonymous ftp areas, each one allocated to a different
392 internet address.
393 The file
394 .Pa /etc/ftphosts
395 contains information pertaining to each of the virtual hosts.
396 Each host is defined on its own line which contains a number of
397 fields separated by whitespace:
398 .Bl -tag -offset indent -width hostname
399 .It hostname
400 Contains the hostname or IP address of the virtual host.
401 .It user
402 Contains a user record in the system password file.
403 As with normal anonymous ftp, this user's access uid, gid and group
404 memberships determine file access to the anonymous ftp area.
405 The anonymous ftp area (to which any user is chrooted on login)
406 is determined by the home directory defined for the account.
407 User id and group for any ftp account may be the same as for the
408 standard ftp user.
409 .It statfile
410 File to which all file transfers are logged, which
411 defaults to
412 .Pa /var/log/ftpd .
413 .It welcome
414 This file is the welcome message displayed before the server ready
415 prompt.
416 It defaults to
417 .Pa /etc/ftpwelcome .
418 .It motd
419 This file is displayed after the user logs in.
420 It defaults to
421 .Pa /etc/ftpmotd .
422 .El
423 .Pp
424 Lines beginning with a '#' are ignored and can be used to include
425 comments.
426 .Pp
427 Defining a virtual host for the primary IP address or hostname
428 changes the default for ftp logins to that address.
429 The 'user', 'statfile', 'welcome' and 'motd' fields may be left
430 blank, or a single hypen '-' used to indicate that the default
431 value is to be used.
432 .Pp
433 As with any anonymous login configuration, due care must be given
434 to setup and maintenance to guard against security related problems.
435 .Pp
436 .Nm
437 has internal support for handling remote requests to list
438 files, and will not execute
439 .Pa /bin/ls
440 in either a chrooted or non-chrooted environment. The
441 .Pa ~/bin/ls
442 executable need not be placed into the chrooted tree, nor need the
443 .Pa ~/bin
444 directory exist.
445 .Sh FILES
446 .Bl -tag -width /etc/ftpwelcome -compact
447 .It Pa /etc/ftpusers
448 List of unwelcome/restricted users.
449 .It Pa /etc/ftpchroot
450 List of normal users who should be chroot'd.
451 .It Pa /etc/ftphosts
452 Virtual hosting configuration file.
453 .It Pa /etc/ftpwelcome
454 Welcome notice.
455 .It Pa /etc/ftpmotd
456 Welcome notice after login.
457 .It Pa /var/run/nologin
458 Displayed and access refused.
459 .It Pa /var/log/ftpd
460 Log file for anonymous transfers.
461 .El
462 .Sh SEE ALSO
463 .Xr ftp 1 ,
464 .Xr key 1 ,
465 .Xr getusershell 3 ,
466 .Xr login.conf 5 ,
467 .Xr inetd 8 ,
468 .Xr syslogd 8
469 .Sh BUGS
470 The server must run as the super-user
471 to create sockets with privileged port numbers. It maintains
472 an effective user id of the logged in user, reverting to
473 the super-user only when binding addresses to sockets. The
474 possible security holes have been extensively
475 scrutinized, but are possibly incomplete.
476 .Sh HISTORY
477 The
478 .Nm
479 command appeared in
480 .Bx 4.2 .
481 IPv6 support was added in WIDE Hydrangea IPv6 stack kit.