xref: /freebsd/libexec/ftpd/ftpd.8 (revision e07d11b69199483fd3175b5f17ad5fff35ae0677)
1ea022d16SRodney W. Grimes.\" Copyright (c) 1985, 1988, 1991, 1993
2ea022d16SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3ea022d16SRodney W. Grimes.\"
4ea022d16SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5ea022d16SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6ea022d16SRodney W. Grimes.\" are met:
7ea022d16SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8ea022d16SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9ea022d16SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10ea022d16SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11ea022d16SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
125efaea4cSChristian Brueffer.\" 3. Neither the name of the University nor the names of its contributors
13ea022d16SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
14ea022d16SRodney W. Grimes.\"    without specific prior written permission.
15ea022d16SRodney W. Grimes.\"
16ea022d16SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17ea022d16SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18ea022d16SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19ea022d16SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20ea022d16SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21ea022d16SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22ea022d16SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23ea022d16SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24ea022d16SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25ea022d16SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26ea022d16SRodney W. Grimes.\" SUCH DAMAGE.
27ea022d16SRodney W. Grimes.\"
28ea022d16SRodney W. Grimes.\"     @(#)ftpd.8	8.2 (Berkeley) 4/19/94
297f3dea24SPeter Wemm.\" $FreeBSD$
30ea022d16SRodney W. Grimes.\"
31eae8be70SEitan Adler.Dd January 21, 2010
32ea022d16SRodney W. Grimes.Dt FTPD 8
330efe23d6SRuslan Ermilov.Os
34ea022d16SRodney W. Grimes.Sh NAME
35ea022d16SRodney W. Grimes.Nm ftpd
36eb083802SRuslan Ermilov.Nd Internet File Transfer Protocol server
37ea022d16SRodney W. Grimes.Sh SYNOPSIS
3876081989SRuslan Ermilov.Nm
39*e07d11b6SKurt Lidl.Op Fl 468ABDdEhMmOoRrSUvW
40a206edcdSMike Pritchard.Op Fl l Op Fl l
41105a3c98SJulian Elischer.Op Fl a Ar address
4263591ba5SYaroslav Tykhiy.Op Fl P Ar port
43105a3c98SJulian Elischer.Op Fl p Ar file
440e063efeSYaroslav Tykhiy.Op Fl T Ar maxtimeout
45d939fc70SRuslan Ermilov.Op Fl t Ar timeout
4638ed70b1SYaroslav Tykhiy.Op Fl u Ar umask
47ea022d16SRodney W. Grimes.Sh DESCRIPTION
483f162cb8SPhilippe CharnierThe
493f162cb8SPhilippe Charnier.Nm
503f162cb8SPhilippe Charnierutility is the
51ea022d16SRodney W. GrimesInternet File Transfer Protocol
52c481aa05SRuslan Ermilovserver process.
53c481aa05SRuslan ErmilovThe server uses the
54ea022d16SRodney W. Grimes.Tn TCP
55ea022d16SRodney W. Grimesprotocol
5663591ba5SYaroslav Tykhiyand listens at the port specified with the
5763591ba5SYaroslav Tykhiy.Fl P
5863591ba5SYaroslav Tykhiyoption or in the
59ea022d16SRodney W. Grimes.Dq ftp
60ea022d16SRodney W. Grimesservice specification; see
61ea022d16SRodney W. Grimes.Xr services 5 .
62ea022d16SRodney W. Grimes.Pp
63ea022d16SRodney W. GrimesAvailable options:
64e02897faSPhilippe Charnier.Bl -tag -width indent
6548143587SSheldon Hearn.It Fl 4
6648143587SSheldon HearnWhen
6748143587SSheldon Hearn.Fl D
68206fe568SHajimu UMEMOTOis specified, accept connections via
6953ee59feSRuslan Ermilov.Dv AF_INET
7048143587SSheldon Hearnsocket.
7148143587SSheldon Hearn.It Fl 6
7248143587SSheldon HearnWhen
7348143587SSheldon Hearn.Fl D
7448143587SSheldon Hearnis specified, accept connections via
7548143587SSheldon Hearn.Dv AF_INET6
7648143587SSheldon Hearnsocket.
772ea42282SYaroslav Tykhiy.It Fl 8
781fd42e91SYaroslav TykhiyEnable transparent UTF-8 mode.
791fd42e91SYaroslav TykhiyRFC\ 2640 compliant clients will be told that the character encoding
801fd42e91SYaroslav Tykhiyused by the server is UTF-8, which is the only effect of the option.
812ea42282SYaroslav Tykhiy.Pp
821fd42e91SYaroslav TykhiyThis option does not enable any encoding conversion for server file names;
831fd42e91SYaroslav Tykhiyit implies instead that the names of files on the server are encoded
841fd42e91SYaroslav Tykhiyin UTF-8.
851fd42e91SYaroslav TykhiyAs for files uploaded via FTP, it is the duty of the RFC\ 2640 compliant
861fd42e91SYaroslav Tykhiyclient to convert their names from the client's local encoding to UTF-8.
871fd42e91SYaroslav TykhiyFTP command names and own
881fd42e91SYaroslav Tykhiy.Nm
891fd42e91SYaroslav Tykhiymessages are always encoded in ASCII, which is a subset of UTF-8.
901fd42e91SYaroslav TykhiyHence no need for server-side conversion at all.
91d939fc70SRuslan Ermilov.It Fl A
92d939fc70SRuslan ErmilovAllow only anonymous ftp access.
930e063efeSYaroslav Tykhiy.It Fl a
940e063efeSYaroslav TykhiyWhen
950e063efeSYaroslav Tykhiy.Fl D
960e063efeSYaroslav Tykhiyis specified, accept connections only on the specified
970e063efeSYaroslav Tykhiy.Ar address .
98*e07d11b6SKurt Lidl.It Fl B
99*e07d11b6SKurt LidlWith this option set,
100*e07d11b6SKurt Lidl.Nm
101*e07d11b6SKurt Lidlsends authentication success and failure messages to the
102*e07d11b6SKurt Lidl.Xr blacklistd 8
103*e07d11b6SKurt Lidldaemon.  If this option is not specified, no communcation with the
104*e07d11b6SKurt Lidl.Xr blacklistd 8
105*e07d11b6SKurt Lidldaemon is attempted.
106cf09a206SDavid Greenman.It Fl D
107cf09a206SDavid GreenmanWith this option set,
108e02897faSPhilippe Charnier.Nm
109cf09a206SDavid Greenmanwill detach and become a daemon, accepting connections on the FTP port and
11019a05e11SRuslan Ermilovforking children processes to handle them.
11119a05e11SRuslan ErmilovThis is lower overhead than starting
112e02897faSPhilippe Charnier.Nm
113cf09a206SDavid Greenmanfrom
114cf09a206SDavid Greenman.Xr inetd 8
115cf09a206SDavid Greenmanand is thus useful on busy servers to reduce load.
116d939fc70SRuslan Ermilov.It Fl d
117d939fc70SRuslan ErmilovDebugging information is written to the syslog using
118d939fc70SRuslan Ermilov.Dv LOG_FTP .
11948143587SSheldon Hearn.It Fl E
12048143587SSheldon HearnDisable the EPSV command.
12148143587SSheldon HearnThis is useful for servers behind older firewalls.
122c152df28SYaroslav Tykhiy.It Fl h
123c152df28SYaroslav TykhiyDisable printing host-specific information, such as the
124c152df28SYaroslav Tykhiyserver software version or hostname, in server messages.
12548143587SSheldon Hearn.It Fl l
12648143587SSheldon HearnEach successful and failed
12748143587SSheldon Hearn.Xr ftp 1
12848143587SSheldon Hearnsession is logged using syslog with a facility of
12948143587SSheldon Hearn.Dv LOG_FTP .
13048143587SSheldon HearnIf this option is specified twice, the retrieve (get), store (put), append,
13148143587SSheldon Hearndelete, make directory, remove directory and rename operations and
13248143587SSheldon Hearntheir filename arguments are also logged.
133d939fc70SRuslan ErmilovBy default,
13448143587SSheldon Hearn.Xr syslogd 8
135d939fc70SRuslan Ermilovlogs these to
136d939fc70SRuslan Ermilov.Pa /var/log/xferlog .
137d939fc70SRuslan Ermilov.It Fl M
138d939fc70SRuslan ErmilovPrevent anonymous users from creating directories.
139a117c345SYaroslav Tykhiy.It Fl m
140a117c345SYaroslav TykhiyPermit anonymous users to overwrite or modify
141a117c345SYaroslav Tykhiyexisting files if allowed by file system permissions.
142a117c345SYaroslav TykhiyBy default, anonymous users cannot modify existing files;
143a117c345SYaroslav Tykhiyin particular, files to upload will be created under a unique name.
1440e063efeSYaroslav Tykhiy.It Fl O
1450e063efeSYaroslav TykhiyPut server in write-only mode for anonymous users only.
1460e063efeSYaroslav TykhiyRETR is disabled for anonymous users, preventing anonymous downloads.
1470e063efeSYaroslav TykhiyThis has no effect if
1480e063efeSYaroslav Tykhiy.Fl o
1490e063efeSYaroslav Tykhiyis also specified.
150d939fc70SRuslan Ermilov.It Fl o
151d939fc70SRuslan ErmilovPut server in write-only mode.
152d939fc70SRuslan ErmilovRETR is disabled, preventing downloads.
15363591ba5SYaroslav Tykhiy.It Fl P
15463591ba5SYaroslav TykhiyWhen
15563591ba5SYaroslav Tykhiy.Fl D
15663591ba5SYaroslav Tykhiyis specified, accept connections at
15763591ba5SYaroslav Tykhiy.Ar port ,
15863591ba5SYaroslav Tykhiyspecified as a numeric value or service name, instead of at the default
15963591ba5SYaroslav Tykhiy.Dq ftp
16063591ba5SYaroslav Tykhiyport.
1610e063efeSYaroslav Tykhiy.It Fl p
1620e063efeSYaroslav TykhiyWhen
1630e063efeSYaroslav Tykhiy.Fl D
1640e063efeSYaroslav Tykhiyis specified, write the daemon's process ID to
165125b9635SYaroslav Tykhiy.Ar file
166125b9635SYaroslav Tykhiyinstead of the default pid file,
167125b9635SYaroslav Tykhiy.Pa /var/run/ftpd.pid .
1680e063efeSYaroslav Tykhiy.It Fl R
1690e063efeSYaroslav TykhiyWith this option set,
1700e063efeSYaroslav Tykhiy.Nm
1710e063efeSYaroslav Tykhiywill revert to historical behavior with regard to security checks on
1720e063efeSYaroslav Tykhiyuser operations and restrictions on PORT requests.
1730e063efeSYaroslav TykhiyCurrently,
1740e063efeSYaroslav Tykhiy.Nm
1750e063efeSYaroslav Tykhiywill only honor PORT commands directed to unprivileged ports on the
1760e063efeSYaroslav Tykhiyremote user's host (which violates the FTP protocol specification but
1770e063efeSYaroslav Tykhiycloses some security holes).
178d939fc70SRuslan Ermilov.It Fl r
179d939fc70SRuslan ErmilovPut server in read-only mode.
180d939fc70SRuslan ErmilovAll commands which may modify the local file system are disabled.
1810e063efeSYaroslav Tykhiy.It Fl S
1820e063efeSYaroslav TykhiyWith this option set,
1830e063efeSYaroslav Tykhiy.Nm
1840e063efeSYaroslav Tykhiylogs all anonymous file downloads to the file
1850e063efeSYaroslav Tykhiy.Pa /var/log/ftpd
1860e063efeSYaroslav Tykhiywhen this file exists.
187ea022d16SRodney W. Grimes.It Fl T
188ea022d16SRodney W. GrimesA client may also request a different timeout period;
189ea022d16SRodney W. Grimesthe maximum period allowed may be set to
190ea022d16SRodney W. Grimes.Ar timeout
191ea022d16SRodney W. Grimesseconds with the
192ea022d16SRodney W. Grimes.Fl T
193ea022d16SRodney W. Grimesoption.
194ea022d16SRodney W. GrimesThe default limit is 2 hours.
195d939fc70SRuslan Ermilov.It Fl t
196d939fc70SRuslan ErmilovThe inactivity timeout period is set to
197d939fc70SRuslan Ermilov.Ar timeout
198d939fc70SRuslan Ermilovseconds (the default is 15 minutes).
1990e063efeSYaroslav Tykhiy.It Fl U
200d28af255SMike SilbersackThis option instructs ftpd to use data ports in the range of
201c00ee5e5SRuslan Ermilov.Dv IP_PORTRANGE_DEFAULT
202c00ee5e5SRuslan Ermilovinstead of in the range of
203c00ee5e5SRuslan Ermilov.Dv IP_PORTRANGE_HIGH .
204d28af255SMike SilbersackSuch a change may be useful for some specific firewall configurations;
205d28af255SMike Silbersacksee
206d28af255SMike Silbersack.Xr ip 4
207d28af255SMike Silbersackfor more information.
208d28af255SMike Silbersack.Pp
209c00ee5e5SRuslan ErmilovNote that option is a virtual no-op in
210c00ee5e5SRuslan Ermilov.Fx 5.0
211c00ee5e5SRuslan Ermilovand above; both port
2129b7076d1SMaxim Konovalovranges are identical by default.
213d939fc70SRuslan Ermilov.It Fl u
214d939fc70SRuslan ErmilovThe default file creation mode mask is set to
215d939fc70SRuslan Ermilov.Ar umask ,
216d939fc70SRuslan Ermilovwhich is expected to be an octal numeric value.
217d939fc70SRuslan ErmilovRefer to
218d939fc70SRuslan Ermilov.Xr umask 2
219d939fc70SRuslan Ermilovfor details.
220a707b683SCeri DaviesThis option may be overridden by
221a707b683SCeri Davies.Xr login.conf 5 .
22293bd9dc5SYaroslav Tykhiy.It Fl v
22393bd9dc5SYaroslav TykhiyA synonym for
22493bd9dc5SYaroslav Tykhiy.Fl d .
2255d7e0128SYaroslav Tykhiy.It Fl W
2260806dd92SEd SchoutenDo not log FTP sessions to the user accounting database.
227ea022d16SRodney W. Grimes.El
228ea022d16SRodney W. Grimes.Pp
229ea022d16SRodney W. GrimesThe file
2300e510aedSSatoshi Asami.Pa /var/run/nologin
231ea022d16SRodney W. Grimescan be used to disable ftp access.
232ea022d16SRodney W. GrimesIf the file exists,
233ea022d16SRodney W. Grimes.Nm
234ea022d16SRodney W. Grimesdisplays it and exits.
235ea022d16SRodney W. GrimesIf the file
236ea022d16SRodney W. Grimes.Pa /etc/ftpwelcome
237ea022d16SRodney W. Grimesexists,
238ea022d16SRodney W. Grimes.Nm
239ea022d16SRodney W. Grimesprints it before issuing the
240ea022d16SRodney W. Grimes.Dq ready
241ea022d16SRodney W. Grimesmessage.
242ea022d16SRodney W. GrimesIf the file
243025362a7SGary Palmer.Pa /etc/ftpmotd
244ea022d16SRodney W. Grimesexists,
245ea022d16SRodney W. Grimes.Nm
246c481aa05SRuslan Ermilovprints it after a successful login.
247c481aa05SRuslan ErmilovNote the motd file used is the one
248c481aa05SRuslan Ermilovrelative to the login environment.
249c481aa05SRuslan ErmilovThis means the one in
250f97d7807SDavid E. O'Brien.Pa ~ftp/etc
251f97d7807SDavid E. O'Brienin the anonymous user's case.
252ea022d16SRodney W. Grimes.Pp
253ea022d16SRodney W. GrimesThe ftp server currently supports the following ftp requests.
254c481aa05SRuslan ErmilovThe case of the requests is ignored.
255c481aa05SRuslan ErmilovRequests marked [RW] are
256a4b77a2aSPoul-Henning Kampdisabled if
257a4b77a2aSPoul-Henning Kamp.Fl r
258a4b77a2aSPoul-Henning Kampis specified.
259ea022d16SRodney W. Grimes.Bl -column "Request" -offset indent
260e02897faSPhilippe Charnier.It Sy Request Ta Sy "Description"
261ea022d16SRodney W. Grimes.It ABOR Ta "abort previous command"
262ea022d16SRodney W. Grimes.It ACCT Ta "specify account (ignored)"
263ea022d16SRodney W. Grimes.It ALLO Ta "allocate storage (vacuously)"
264a4b77a2aSPoul-Henning Kamp.It APPE Ta "append to a file [RW]"
265ea022d16SRodney W. Grimes.It CDUP Ta "change to parent of current working directory"
266ea022d16SRodney W. Grimes.It CWD Ta "change working directory"
267a4b77a2aSPoul-Henning Kamp.It DELE Ta "delete a file [RW]"
268a4b77a2aSPoul-Henning Kamp.It EPRT Ta "specify data connection port, multiprotocol"
269a4b77a2aSPoul-Henning Kamp.It EPSV Ta "prepare for server-to-server transfer, multiprotocol"
2702ea42282SYaroslav Tykhiy.It FEAT Ta "give information on extended features of server"
271ea022d16SRodney W. Grimes.It HELP Ta "give help information"
272ea022d16SRodney W. Grimes.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA"
273a4b77a2aSPoul-Henning Kamp.It LPRT Ta "specify data connection port, multiprotocol"
274a4b77a2aSPoul-Henning Kamp.It LPSV Ta "prepare for server-to-server transfer, multiprotocol"
275ea022d16SRodney W. Grimes.It MDTM Ta "show last modification time of file"
276a4b77a2aSPoul-Henning Kamp.It MKD Ta "make a directory [RW]"
277ea022d16SRodney W. Grimes.It MODE Ta "specify data transfer" Em mode
278ea022d16SRodney W. Grimes.It NLST Ta "give name list of files in directory"
279ea022d16SRodney W. Grimes.It NOOP Ta "do nothing"
280ea022d16SRodney W. Grimes.It PASS Ta "specify password"
281ea022d16SRodney W. Grimes.It PASV Ta "prepare for server-to-server transfer"
282ea022d16SRodney W. Grimes.It PORT Ta "specify data connection port"
283ea022d16SRodney W. Grimes.It PWD Ta "print the current working directory"
284ea022d16SRodney W. Grimes.It QUIT Ta "terminate session"
285ea022d16SRodney W. Grimes.It REST Ta "restart incomplete transfer"
286ea022d16SRodney W. Grimes.It RETR Ta "retrieve a file"
287a4b77a2aSPoul-Henning Kamp.It RMD Ta "remove a directory [RW]"
288a4b77a2aSPoul-Henning Kamp.It RNFR Ta "specify rename-from file name [RW]"
289a4b77a2aSPoul-Henning Kamp.It RNTO Ta "specify rename-to file name [RW]"
290ea022d16SRodney W. Grimes.It SITE Ta "non-standard commands (see next section)"
291ea022d16SRodney W. Grimes.It SIZE Ta "return size of file"
292ea022d16SRodney W. Grimes.It STAT Ta "return status of server"
293a4b77a2aSPoul-Henning Kamp.It STOR Ta "store a file [RW]"
294a4b77a2aSPoul-Henning Kamp.It STOU Ta "store a file with a unique name [RW]"
295ea022d16SRodney W. Grimes.It STRU Ta "specify data transfer" Em structure
296ea022d16SRodney W. Grimes.It SYST Ta "show operating system type of server system"
297ea022d16SRodney W. Grimes.It TYPE Ta "specify data transfer" Em type
298ea022d16SRodney W. Grimes.It USER Ta "specify user name"
299ea022d16SRodney W. Grimes.It XCUP Ta "change to parent of current working directory (deprecated)"
300ea022d16SRodney W. Grimes.It XCWD Ta "change working directory (deprecated)"
301a4b77a2aSPoul-Henning Kamp.It XMKD Ta "make a directory (deprecated) [RW]"
302ea022d16SRodney W. Grimes.It XPWD Ta "print the current working directory (deprecated)"
303a4b77a2aSPoul-Henning Kamp.It XRMD Ta "remove a directory (deprecated) [RW]"
304ea022d16SRodney W. Grimes.El
305ea022d16SRodney W. Grimes.Pp
306ea022d16SRodney W. GrimesThe following non-standard or
307d939fc70SRuslan Ermilov.Ux
308ea022d16SRodney W. Grimesspecific commands are supported
309ea022d16SRodney W. Grimesby the
310ea022d16SRodney W. GrimesSITE request.
311ea022d16SRodney W. Grimes.Bl -column Request -offset indent
312ea022d16SRodney W. Grimes.It Sy Request Ta Sy Description
313ea022d16SRodney W. Grimes.It UMASK Ta change umask, e.g. ``SITE UMASK 002''
314ea022d16SRodney W. Grimes.It IDLE Ta set idle-timer, e.g. ``SITE IDLE 60''
315a4b77a2aSPoul-Henning Kamp.It CHMOD Ta "change mode of a file [RW], e.g. ``SITE CHMOD 755 filename''"
31653ba84a6SPoul-Henning Kamp.It MD5 Ta "report the files MD5 checksum, e.g. ``SITE MD5 filename''"
317e02897faSPhilippe Charnier.It HELP Ta give help information
318ea022d16SRodney W. Grimes.El
319ea022d16SRodney W. Grimes.Pp
3206a01974bSRuslan ErmilovNote: SITE requests are disabled in case of anonymous logins.
3216a01974bSRuslan Ermilov.Pp
322ea022d16SRodney W. GrimesThe remaining ftp requests specified in Internet RFC 959
323ea022d16SRodney W. Grimesare
324ea022d16SRodney W. Grimesrecognized, but not implemented.
325ea022d16SRodney W. GrimesMDTM and SIZE are not specified in RFC 959, but will appear in the
326ea022d16SRodney W. Grimesnext updated FTP RFC.
327255a7037SYaroslav TykhiyTo avoid possible denial-of-service attacks, SIZE requests against
328255a7037SYaroslav Tykhiyfiles larger than 10240 bytes will be denied if the current transfer
329255a7037SYaroslav Tykhiytype is ASCII.
330ea022d16SRodney W. Grimes.Pp
331ea022d16SRodney W. GrimesThe ftp server will abort an active file transfer only when the
332ea022d16SRodney W. GrimesABOR
333ea022d16SRodney W. Grimescommand is preceded by a Telnet "Interrupt Process" (IP)
334ea022d16SRodney W. Grimessignal and a Telnet "Synch" signal in the command Telnet stream,
335ea022d16SRodney W. Grimesas described in Internet RFC 959.
336ea022d16SRodney W. GrimesIf a
337ea022d16SRodney W. GrimesSTAT
338ea022d16SRodney W. Grimescommand is received during a data transfer, preceded by a Telnet IP
339ea022d16SRodney W. Grimesand Synch, transfer status will be returned.
340ea022d16SRodney W. Grimes.Pp
3413f162cb8SPhilippe CharnierThe
3423f162cb8SPhilippe Charnier.Nm
3433f162cb8SPhilippe Charnierutility interprets file names according to the
344ea022d16SRodney W. Grimes.Dq globbing
345ea022d16SRodney W. Grimesconventions used by
346ea022d16SRodney W. Grimes.Xr csh 1 .
347ea022d16SRodney W. GrimesThis allows users to utilize the metacharacters
348ea022d16SRodney W. Grimes.Dq Li \&*?[]{}~ .
349ea022d16SRodney W. Grimes.Pp
3503f162cb8SPhilippe CharnierThe
3513f162cb8SPhilippe Charnier.Nm
3523f162cb8SPhilippe Charnierutility authenticates users according to six rules.
353ea022d16SRodney W. Grimes.Bl -enum -offset indent
354ea022d16SRodney W. Grimes.It
35542946c82SMike PritchardThe login name must be in the password data base
356ea022d16SRodney W. Grimesand not have a null password.
357ea022d16SRodney W. GrimesIn this case a password must be provided by the client before any
358ea022d16SRodney W. Grimesfile operations may be performed.
359dcac077fSTom RhodesIf the user has an OPIE key, the response from a successful USER
360dcac077fSTom Rhodescommand will include an OPIE challenge.
36119a05e11SRuslan ErmilovThe client may choose to respond with a PASS command giving either
362dcac077fSTom Rhodesa standard password or an OPIE one-time password.
36319a05e11SRuslan ErmilovThe server will automatically determine which type of
36419a05e11SRuslan Ermilovpassword it has been given and attempt to authenticate accordingly.
36519a05e11SRuslan ErmilovSee
366dcac077fSTom Rhodes.Xr opie 4
367dcac077fSTom Rhodesfor more information on OPIE authentication.
368ea022d16SRodney W. Grimes.It
369ea022d16SRodney W. GrimesThe login name must not appear in the file
370ea022d16SRodney W. Grimes.Pa /etc/ftpusers .
371ea022d16SRodney W. Grimes.It
37231fea7b8SDavid NugentThe login name must not be a member of a group specified in the file
37331fea7b8SDavid Nugent.Pa /etc/ftpusers .
37431fea7b8SDavid NugentEntries in this file interpreted as group names are prefixed by an "at"
37531fea7b8SDavid Nugent.Ql \&@
37631fea7b8SDavid Nugentsign.
37731fea7b8SDavid Nugent.It
378ea022d16SRodney W. GrimesThe user must have a standard shell returned by
379ea022d16SRodney W. Grimes.Xr getusershell 3 .
380ea022d16SRodney W. Grimes.It
381a5a4544eSPaul TrainaIf the user name appears in the file
38231fea7b8SDavid Nugent.Pa /etc/ftpchroot ,
38331fea7b8SDavid Nugentor the user is a member of a group with a group entry in this file,
384c481aa05SRuslan Ermilovi.e., one prefixed with
38531fea7b8SDavid Nugent.Ql \&@ ,
3868657b576SYaroslav Tykhiythe session's root will be changed to the directory specified
3878657b576SYaroslav Tykhiyin this file or to the user's login directory by
388a5a4544eSPaul Traina.Xr chroot 2
389a5a4544eSPaul Trainaas for an
390a5a4544eSPaul Traina.Dq anonymous
391a5a4544eSPaul Trainaor
392a5a4544eSPaul Traina.Dq ftp
393b071c689SDavid Nugentaccount (see next item).
3948657b576SYaroslav TykhiySee
3958657b576SYaroslav Tykhiy.Xr ftpchroot 5
3968657b576SYaroslav Tykhiyfor a detailed description of the format of this file.
39731fea7b8SDavid NugentThis facility may also be triggered by enabling the boolean "ftp-chroot"
398b071c689SDavid Nugentcapability in
399b071c689SDavid Nugent.Xr login.conf 5 .
400b071c689SDavid NugentHowever, the user must still supply a password.
401ea4e54b9SDavid NugentThis feature is intended as a compromise between a fully anonymous
402ea4e54b9SDavid Nugentaccount and a fully privileged account.
40331fea7b8SDavid NugentThe account should also be set up as for an anonymous account.
404a5a4544eSPaul Traina.It
405ea022d16SRodney W. GrimesIf the user name is
406ea022d16SRodney W. Grimes.Dq anonymous
407ea022d16SRodney W. Grimesor
408ea022d16SRodney W. Grimes.Dq ftp ,
409ea022d16SRodney W. Grimesan
410ea022d16SRodney W. Grimesanonymous ftp account must be present in the password
411ea022d16SRodney W. Grimesfile (user
412ea022d16SRodney W. Grimes.Dq ftp ) .
413ea022d16SRodney W. GrimesIn this case the user is allowed
414ea022d16SRodney W. Grimesto log in by specifying any password (by convention an email address for
415a5a4544eSPaul Trainathe user should be used as the password).
416a5a4544eSPaul TrainaWhen the
4173eb568f2SGuido van Rooij.Fl S
4183eb568f2SGuido van Rooijoption is set, all transfers are logged as well.
419ea022d16SRodney W. Grimes.El
420ea022d16SRodney W. Grimes.Pp
421ea022d16SRodney W. GrimesIn the last case,
422e02897faSPhilippe Charnier.Nm
423ea022d16SRodney W. Grimestakes special measures to restrict the client's access privileges.
424ea022d16SRodney W. GrimesThe server performs a
425ea022d16SRodney W. Grimes.Xr chroot 2
426ea022d16SRodney W. Grimesto the home directory of the
427ea022d16SRodney W. Grimes.Dq ftp
428ea022d16SRodney W. Grimesuser.
429ce9287fcSYaroslav TykhiyAs a special case if the
430ce9287fcSYaroslav Tykhiy.Dq ftp
431ce9287fcSYaroslav Tykhiyuser's home directory pathname contains the
432ace5be68SRuslan Ermilov.Pa /./
433ce9287fcSYaroslav Tykhiyseparator,
434ce9287fcSYaroslav Tykhiy.Nm
435ce9287fcSYaroslav Tykhiyuses its left-hand side as the name of the directory to do
436ce9287fcSYaroslav Tykhiy.Xr chroot 2
437ce9287fcSYaroslav Tykhiyto, and its right-hand side to change the current directory to afterwards.
438ce9287fcSYaroslav TykhiyA typical example for this case would be
439ce9287fcSYaroslav Tykhiy.Pa /usr/local/ftp/./pub .
440ea022d16SRodney W. GrimesIn order that system security is not breached, it is recommended
441ea022d16SRodney W. Grimesthat the
442ea022d16SRodney W. Grimes.Dq ftp
443ea022d16SRodney W. Grimessubtree be constructed with care, following these rules:
444ea022d16SRodney W. Grimes.Bl -tag -width "~ftp/pub" -offset indent
445ea022d16SRodney W. Grimes.It Pa ~ftp
446ea022d16SRodney W. GrimesMake the home directory owned by
447ea022d16SRodney W. Grimes.Dq root
448ea022d16SRodney W. Grimesand unwritable by anyone.
449ea022d16SRodney W. Grimes.It Pa ~ftp/etc
450ea022d16SRodney W. GrimesMake this directory owned by
451ea022d16SRodney W. Grimes.Dq root
452ea022d16SRodney W. Grimesand unwritable by anyone (mode 555).
453a5a4544eSPaul TrainaThe files pwd.db (see
454a5a4544eSPaul Traina.Xr passwd 5 )
455ea022d16SRodney W. Grimesand
456ea022d16SRodney W. Grimes.Xr group 5
457ea022d16SRodney W. Grimesmust be present for the
4583f162cb8SPhilippe Charnier.Xr ls 1
459ea022d16SRodney W. Grimescommand to be able to produce owner names rather than numbers.
460ea022d16SRodney W. GrimesThe password field in
46142161502SPhilippe Charnier.Xr passwd 5
462ea022d16SRodney W. Grimesis not used, and should not contain real passwords.
463ea022d16SRodney W. GrimesThe file
4647253b58bSGary Palmer.Pa ftpmotd ,
465ea022d16SRodney W. Grimesif present, will be printed after a successful login.
466ea022d16SRodney W. GrimesThese files should be mode 444.
467ea022d16SRodney W. Grimes.It Pa ~ftp/pub
4689ba6d8e4SMike HeffnerThis directory and the subdirectories beneath it should be owned
4699ba6d8e4SMike Heffnerby the users and groups responsible for placing files in them,
4709ba6d8e4SMike Heffnerand be writable only by them (mode 755 or 775).
4719ba6d8e4SMike HeffnerThey should
4729ba6d8e4SMike Heffner.Em not
473a8838c53SRuslan Ermilovbe owned or writable by
474a8838c53SRuslan Ermilov.Dq ftp
475a8838c53SRuslan Ermilovor its group, otherwise guest users
4769ba6d8e4SMike Heffnercan fill the drive with unwanted files.
477ea022d16SRodney W. Grimes.El
478334ab9fdSDavid Nugent.Pp
479ea4e54b9SDavid NugentIf the system has multiple IP addresses,
480e02897faSPhilippe Charnier.Nm
481ea4e54b9SDavid Nugentsupports the idea of virtual hosts, which provides the ability to
482ea4e54b9SDavid Nugentdefine multiple anonymous ftp areas, each one allocated to a different
483ea4e54b9SDavid Nugentinternet address.
484ea4e54b9SDavid NugentThe file
485ea4e54b9SDavid Nugent.Pa /etc/ftphosts
486ea4e54b9SDavid Nugentcontains information pertaining to each of the virtual hosts.
487ea4e54b9SDavid NugentEach host is defined on its own line which contains a number of
488ea4e54b9SDavid Nugentfields separated by whitespace:
489ea4e54b9SDavid Nugent.Bl -tag -offset indent -width hostname
490ea4e54b9SDavid Nugent.It hostname
491ea4e54b9SDavid NugentContains the hostname or IP address of the virtual host.
492ea4e54b9SDavid Nugent.It user
493ea4e54b9SDavid NugentContains a user record in the system password file.
494ea4e54b9SDavid NugentAs with normal anonymous ftp, this user's access uid, gid and group
495ea4e54b9SDavid Nugentmemberships determine file access to the anonymous ftp area.
496ea4e54b9SDavid NugentThe anonymous ftp area (to which any user is chrooted on login)
497ea4e54b9SDavid Nugentis determined by the home directory defined for the account.
498ea4e54b9SDavid NugentUser id and group for any ftp account may be the same as for the
499ea4e54b9SDavid Nugentstandard ftp user.
500ea4e54b9SDavid Nugent.It statfile
501ea4e54b9SDavid NugentFile to which all file transfers are logged, which
502ea4e54b9SDavid Nugentdefaults to
503ea4e54b9SDavid Nugent.Pa /var/log/ftpd .
504ea4e54b9SDavid Nugent.It welcome
505ea4e54b9SDavid NugentThis file is the welcome message displayed before the server ready
506ea4e54b9SDavid Nugentprompt.
507ea4e54b9SDavid NugentIt defaults to
508ea4e54b9SDavid Nugent.Pa /etc/ftpwelcome .
509ea4e54b9SDavid Nugent.It motd
510ea4e54b9SDavid NugentThis file is displayed after the user logs in.
511ea4e54b9SDavid NugentIt defaults to
512ea4e54b9SDavid Nugent.Pa /etc/ftpmotd .
513ea4e54b9SDavid Nugent.El
514ea4e54b9SDavid Nugent.Pp
515d59b62e3SJoseph KoshyLines beginning with a '#' are ignored and can be used to include
516d59b62e3SJoseph Koshycomments.
517d59b62e3SJoseph Koshy.Pp
518ea4e54b9SDavid NugentDefining a virtual host for the primary IP address or hostname
519ea4e54b9SDavid Nugentchanges the default for ftp logins to that address.
520ea4e54b9SDavid NugentThe 'user', 'statfile', 'welcome' and 'motd' fields may be left
52157bd0fc6SJens Schweikhardtblank, or a single hyphen '-' used to indicate that the default
522ea4e54b9SDavid Nugentvalue is to be used.
523ea4e54b9SDavid Nugent.Pp
524ea4e54b9SDavid NugentAs with any anonymous login configuration, due care must be given
525ea4e54b9SDavid Nugentto setup and maintenance to guard against security related problems.
526ea4e54b9SDavid Nugent.Pp
5273f162cb8SPhilippe CharnierThe
528e02897faSPhilippe Charnier.Nm
5293f162cb8SPhilippe Charnierutility has internal support for handling remote requests to list
530334ab9fdSDavid Nugentfiles, and will not execute
531334ab9fdSDavid Nugent.Pa /bin/ls
532c481aa05SRuslan Ermilovin either a chrooted or non-chrooted environment.
533c481aa05SRuslan ErmilovThe
534334ab9fdSDavid Nugent.Pa ~/bin/ls
535334ab9fdSDavid Nugentexecutable need not be placed into the chrooted tree, nor need the
536334ab9fdSDavid Nugent.Pa ~/bin
537334ab9fdSDavid Nugentdirectory exist.
538ea022d16SRodney W. Grimes.Sh FILES
539125b9635SYaroslav Tykhiy.Bl -tag -width ".Pa /var/run/ftpd.pid" -compact
540ea022d16SRodney W. Grimes.It Pa /etc/ftpusers
541ea022d16SRodney W. GrimesList of unwelcome/restricted users.
542a5a4544eSPaul Traina.It Pa /etc/ftpchroot
543a5a4544eSPaul TrainaList of normal users who should be chroot'd.
544f97d7807SDavid E. O'Brien.It Pa /etc/ftphosts
545f97d7807SDavid E. O'BrienVirtual hosting configuration file.
546ea022d16SRodney W. Grimes.It Pa /etc/ftpwelcome
547ea022d16SRodney W. GrimesWelcome notice.
5487253b58bSGary Palmer.It Pa /etc/ftpmotd
549ea022d16SRodney W. GrimesWelcome notice after login.
550125b9635SYaroslav Tykhiy.It Pa /var/run/ftpd.pid
551125b9635SYaroslav TykhiyDefault pid file for daemon mode.
5520e510aedSSatoshi Asami.It Pa /var/run/nologin
553ea022d16SRodney W. GrimesDisplayed and access refused.
5543eb568f2SGuido van Rooij.It Pa /var/log/ftpd
5553eb568f2SGuido van RooijLog file for anonymous transfers.
556d939fc70SRuslan Ermilov.It Pa /var/log/xferlog
557d939fc70SRuslan ErmilovDefault place for session logs.
558ea022d16SRodney W. Grimes.El
559ea022d16SRodney W. Grimes.Sh SEE ALSO
560ea022d16SRodney W. Grimes.Xr ftp 1 ,
56138ed70b1SYaroslav Tykhiy.Xr umask 2 ,
562ea022d16SRodney W. Grimes.Xr getusershell 3 ,
563dcac077fSTom Rhodes.Xr opie 4 ,
5648657b576SYaroslav Tykhiy.Xr ftpchroot 5 ,
565b071c689SDavid Nugent.Xr login.conf 5 ,
566cf09a206SDavid Greenman.Xr inetd 8 ,
567ea022d16SRodney W. Grimes.Xr syslogd 8
568a3ac07a5SRuslan Ermilov.Sh HISTORY
569a3ac07a5SRuslan ErmilovThe
570a3ac07a5SRuslan Ermilov.Nm
571a3ac07a5SRuslan Ermilovutility appeared in
572a3ac07a5SRuslan Ermilov.Bx 4.2 .
573a3ac07a5SRuslan ErmilovIPv6 support was added in WIDE Hydrangea IPv6 stack kit.
574ea022d16SRodney W. Grimes.Sh BUGS
575ea022d16SRodney W. GrimesThe server must run as the super-user
576c481aa05SRuslan Ermilovto create sockets with privileged port numbers.
577c481aa05SRuslan ErmilovIt maintains
578ea022d16SRodney W. Grimesan effective user id of the logged in user, reverting to
579c481aa05SRuslan Ermilovthe super-user only when binding addresses to sockets.
580c481aa05SRuslan ErmilovThe
581ea022d16SRodney W. Grimespossible security holes have been extensively
582ea022d16SRodney W. Grimesscrutinized, but are possibly incomplete.
583