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