xref: /freebsd/libexec/ftpd/ftpd.8 (revision 93bd9dc528f8811d81f61a6a6c0309826d94e40c)
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.
12ea022d16SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
13ea022d16SRodney W. Grimes.\"    must display the following acknowledgement:
14ea022d16SRodney W. Grimes.\"	This product includes software developed by the University of
15ea022d16SRodney W. Grimes.\"	California, Berkeley and its contributors.
16ea022d16SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
17ea022d16SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
18ea022d16SRodney W. Grimes.\"    without specific prior written permission.
19ea022d16SRodney W. Grimes.\"
20ea022d16SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21ea022d16SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22ea022d16SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23ea022d16SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24ea022d16SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25ea022d16SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26ea022d16SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27ea022d16SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28ea022d16SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29ea022d16SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30ea022d16SRodney W. Grimes.\" SUCH DAMAGE.
31ea022d16SRodney W. Grimes.\"
32ea022d16SRodney W. Grimes.\"     @(#)ftpd.8	8.2 (Berkeley) 4/19/94
337f3dea24SPeter Wemm.\" $FreeBSD$
34ea022d16SRodney W. Grimes.\"
354dd8b5abSYoshinobu Inoue.Dd January 27, 2000
36ea022d16SRodney W. Grimes.Dt FTPD 8
370efe23d6SRuslan Ermilov.Os
38ea022d16SRodney W. Grimes.Sh NAME
39ea022d16SRodney W. Grimes.Nm ftpd
40eb083802SRuslan Ermilov.Nd Internet File Transfer Protocol server
41ea022d16SRodney W. Grimes.Sh SYNOPSIS
4276081989SRuslan Ermilov.Nm
4393bd9dc5SYaroslav Tykhiy.Op Fl 46AdDEMoOrRSUv
44a206edcdSMike Pritchard.Op Fl l Op Fl l
45105a3c98SJulian Elischer.Op Fl a Ar address
46105a3c98SJulian Elischer.Op Fl p Ar file
4748143587SSheldon Hearn.Op Fl t Ar timeout
480e063efeSYaroslav Tykhiy.Op Fl T Ar maxtimeout
4938ed70b1SYaroslav Tykhiy.Op Fl u Ar umask
50ea022d16SRodney W. Grimes.Sh DESCRIPTION
513f162cb8SPhilippe CharnierThe
523f162cb8SPhilippe Charnier.Nm
533f162cb8SPhilippe Charnierutility is the
54ea022d16SRodney W. GrimesInternet File Transfer Protocol
55ea022d16SRodney W. Grimesserver process.  The server uses the
56ea022d16SRodney W. Grimes.Tn TCP
57ea022d16SRodney W. Grimesprotocol
58ea022d16SRodney W. Grimesand listens at the port specified 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
6848143587SSheldon Hearnis specified, accept IPv4 connections.
6948143587SSheldon HearnWhen
7048143587SSheldon Hearn.Fl 6
7148143587SSheldon Hearnis also specified, accept IPv4 connection via
7248143587SSheldon Hearn.Dv AF_INET6
7348143587SSheldon Hearnsocket.
7448143587SSheldon HearnWhen
7548143587SSheldon Hearn.Fl 6
7648143587SSheldon Hearnis not specified, accept IPv4 connection via
7748143587SSheldon Hearn.Dv AF_INET
7848143587SSheldon Hearnsocket.
7948143587SSheldon Hearn.It Fl 6
8048143587SSheldon HearnWhen
8148143587SSheldon Hearn.Fl D
8248143587SSheldon Hearnis specified, accept connections via
8348143587SSheldon Hearn.Dv AF_INET6
8448143587SSheldon Hearnsocket.
850e063efeSYaroslav Tykhiy.It Fl a
860e063efeSYaroslav TykhiyWhen
870e063efeSYaroslav Tykhiy.Fl D
880e063efeSYaroslav Tykhiyis specified, accept connections only on the specified
890e063efeSYaroslav Tykhiy.Ar address .
9048143587SSheldon Hearn.It Fl A
9148143587SSheldon HearnAllow only anonymous ftp access.
920e063efeSYaroslav Tykhiy.It Fl d
930e063efeSYaroslav TykhiyDebugging information is written to the syslog using
940e063efeSYaroslav Tykhiy.Dv LOG_FTP .
95cf09a206SDavid Greenman.It Fl D
96cf09a206SDavid GreenmanWith this option set,
97e02897faSPhilippe Charnier.Nm
98cf09a206SDavid Greenmanwill detach and become a daemon, accepting connections on the FTP port and
9919a05e11SRuslan Ermilovforking children processes to handle them.
10019a05e11SRuslan ErmilovThis is lower overhead than starting
101e02897faSPhilippe Charnier.Nm
102cf09a206SDavid Greenmanfrom
103cf09a206SDavid Greenman.Xr inetd 8
104cf09a206SDavid Greenmanand is thus useful on busy servers to reduce load.
10548143587SSheldon Hearn.It Fl E
10648143587SSheldon HearnDisable the EPSV command.
10748143587SSheldon HearnThis is useful for servers behind older firewalls.
10848143587SSheldon Hearn.It Fl l
10948143587SSheldon HearnEach successful and failed
11048143587SSheldon Hearn.Xr ftp 1
11148143587SSheldon Hearnsession is logged using syslog with a facility of
11248143587SSheldon Hearn.Dv LOG_FTP .
11348143587SSheldon HearnIf this option is specified twice, the retrieve (get), store (put), append,
11448143587SSheldon Hearndelete, make directory, remove directory and rename operations and
11548143587SSheldon Hearntheir filename arguments are also logged.
11648143587SSheldon HearnNote:
11748143587SSheldon Hearn.Dv LOG_FTP
11848143587SSheldon Hearnmessages
11948143587SSheldon Hearnare not displayed by
12048143587SSheldon Hearn.Xr syslogd 8
12148143587SSheldon Hearnby default, and may have to be enabled in
12248143587SSheldon Hearn.Xr syslogd 8 Ns 's
12348143587SSheldon Hearnconfiguration file.
1240e063efeSYaroslav Tykhiy.It Fl M
1250e063efeSYaroslav TykhiyPrevent anonymous users from creating directories.
1260e063efeSYaroslav Tykhiy.It Fl o
1270e063efeSYaroslav TykhiyPut server in write-only mode.
1280e063efeSYaroslav TykhiyRETR is disabled, preventing downloads.
1290e063efeSYaroslav Tykhiy.It Fl O
1300e063efeSYaroslav TykhiyPut server in write-only mode for anonymous users only.
1310e063efeSYaroslav TykhiyRETR is disabled for anonymous users, preventing anonymous downloads.
1320e063efeSYaroslav TykhiyThis has no effect if
1330e063efeSYaroslav Tykhiy.Fl o
1340e063efeSYaroslav Tykhiyis also specified.
1350e063efeSYaroslav Tykhiy.It Fl p
1360e063efeSYaroslav TykhiyWhen
1370e063efeSYaroslav Tykhiy.Fl D
1380e063efeSYaroslav Tykhiyis specified, write the daemon's process ID to
1390e063efeSYaroslav Tykhiy.Ar file .
1400e063efeSYaroslav Tykhiy.It Fl r
1410e063efeSYaroslav TykhiyPut server in read-only mode.
1420e063efeSYaroslav TykhiyAll commands which may modify the local filesystem are disabled.
1430e063efeSYaroslav Tykhiy.It Fl R
1440e063efeSYaroslav TykhiyWith this option set,
1450e063efeSYaroslav Tykhiy.Nm
1460e063efeSYaroslav Tykhiywill revert to historical behavior with regard to security checks on
1470e063efeSYaroslav Tykhiyuser operations and restrictions on PORT requests.
1480e063efeSYaroslav TykhiyCurrently,
1490e063efeSYaroslav Tykhiy.Nm
1500e063efeSYaroslav Tykhiywill only honor PORT commands directed to unprivileged ports on the
1510e063efeSYaroslav Tykhiyremote user's host (which violates the FTP protocol specification but
1520e063efeSYaroslav Tykhiycloses some security holes).
1530e063efeSYaroslav Tykhiy.It Fl S
1540e063efeSYaroslav TykhiyWith this option set,
1550e063efeSYaroslav Tykhiy.Nm
1560e063efeSYaroslav Tykhiylogs all anonymous file downloads to the file
1570e063efeSYaroslav Tykhiy.Pa /var/log/ftpd
1580e063efeSYaroslav Tykhiywhen this file exists.
1590e063efeSYaroslav Tykhiy.It Fl t
1600e063efeSYaroslav TykhiyThe inactivity timeout period is set to
1610e063efeSYaroslav Tykhiy.Ar timeout
1620e063efeSYaroslav Tykhiyseconds (the default is 15 minutes).
163ea022d16SRodney W. Grimes.It Fl T
164ea022d16SRodney W. GrimesA client may also request a different timeout period;
165ea022d16SRodney W. Grimesthe maximum period allowed may be set to
166ea022d16SRodney W. Grimes.Ar timeout
167ea022d16SRodney W. Grimesseconds with the
168ea022d16SRodney W. Grimes.Fl T
169ea022d16SRodney W. Grimesoption.
170ea022d16SRodney W. GrimesThe default limit is 2 hours.
17138ed70b1SYaroslav Tykhiy.It Fl u
17238ed70b1SYaroslav TykhiyThe default file creation mode mask is set to
17338ed70b1SYaroslav Tykhiy.Ar umask ,
17438ed70b1SYaroslav Tykhiywhich is expected to be an octal numeric value.
17538ed70b1SYaroslav TykhiyRefer to
17638ed70b1SYaroslav Tykhiy.Xr umask 2
17738ed70b1SYaroslav Tykhiyfor details.
1780e063efeSYaroslav Tykhiy.It Fl U
1790e063efeSYaroslav TykhiyIn previous versions of
1800e063efeSYaroslav Tykhiy.Nm ,
1810e063efeSYaroslav Tykhiywhen a passive mode client requested a data connection to the server,
1820e063efeSYaroslav Tykhiythe server would use data ports in the range 1024..4999.  Now, by default,
1830e063efeSYaroslav Tykhiythe server will use data ports in the range 49152..65535.  Specifying this
1840e063efeSYaroslav Tykhiyoption will revert to the old behavior.
18593bd9dc5SYaroslav Tykhiy.It Fl v
18693bd9dc5SYaroslav TykhiyA synonym for
18793bd9dc5SYaroslav Tykhiy.Fl d .
188ea022d16SRodney W. Grimes.El
189ea022d16SRodney W. Grimes.Pp
190ea022d16SRodney W. GrimesThe file
1910e510aedSSatoshi Asami.Pa /var/run/nologin
192ea022d16SRodney W. Grimescan be used to disable ftp access.
193ea022d16SRodney W. GrimesIf the file exists,
194ea022d16SRodney W. Grimes.Nm
195ea022d16SRodney W. Grimesdisplays it and exits.
196ea022d16SRodney W. GrimesIf the file
197ea022d16SRodney W. Grimes.Pa /etc/ftpwelcome
198ea022d16SRodney W. Grimesexists,
199ea022d16SRodney W. Grimes.Nm
200ea022d16SRodney W. Grimesprints it before issuing the
201ea022d16SRodney W. Grimes.Dq ready
202ea022d16SRodney W. Grimesmessage.
203ea022d16SRodney W. GrimesIf the file
204025362a7SGary Palmer.Pa /etc/ftpmotd
205ea022d16SRodney W. Grimesexists,
206ea022d16SRodney W. Grimes.Nm
207f97d7807SDavid E. O'Brienprints it after a successful login.  Note the motd file used is the one
208f97d7807SDavid E. O'Brienrelative to the login environment.  This means the one in
209f97d7807SDavid E. O'Brien.Pa ~ftp/etc
210f97d7807SDavid E. O'Brienin the anonymous user's case.
211ea022d16SRodney W. Grimes.Pp
212ea022d16SRodney W. GrimesThe ftp server currently supports the following ftp requests.
213a4b77a2aSPoul-Henning KampThe case of the requests is ignored.  Requests marked [RW] are
214a4b77a2aSPoul-Henning Kampdisabled if
215a4b77a2aSPoul-Henning Kamp.Fl r
216a4b77a2aSPoul-Henning Kampis specified.
217ea022d16SRodney W. Grimes.Bl -column "Request" -offset indent
218e02897faSPhilippe Charnier.It Sy Request Ta Sy "Description"
219ea022d16SRodney W. Grimes.It ABOR Ta "abort previous command"
220ea022d16SRodney W. Grimes.It ACCT Ta "specify account (ignored)"
221ea022d16SRodney W. Grimes.It ALLO Ta "allocate storage (vacuously)"
222a4b77a2aSPoul-Henning Kamp.It APPE Ta "append to a file [RW]"
223ea022d16SRodney W. Grimes.It CDUP Ta "change to parent of current working directory"
224ea022d16SRodney W. Grimes.It CWD Ta "change working directory"
225a4b77a2aSPoul-Henning Kamp.It DELE Ta "delete a file [RW]"
226a4b77a2aSPoul-Henning Kamp.It EPRT Ta "specify data connection port, multiprotocol"
227a4b77a2aSPoul-Henning Kamp.It EPSV Ta "prepare for server-to-server transfer, multiprotocol"
228ea022d16SRodney W. Grimes.It HELP Ta "give help information"
229ea022d16SRodney W. Grimes.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA"
230a4b77a2aSPoul-Henning Kamp.It LPRT Ta "specify data connection port, multiprotocol"
231a4b77a2aSPoul-Henning Kamp.It LPSV Ta "prepare for server-to-server transfer, multiprotocol"
232ea022d16SRodney W. Grimes.It MDTM Ta "show last modification time of file"
233a4b77a2aSPoul-Henning Kamp.It MKD Ta "make a directory [RW]"
234ea022d16SRodney W. Grimes.It MODE Ta "specify data transfer" Em mode
235ea022d16SRodney W. Grimes.It NLST Ta "give name list of files in directory"
236ea022d16SRodney W. Grimes.It NOOP Ta "do nothing"
237ea022d16SRodney W. Grimes.It PASS Ta "specify password"
238ea022d16SRodney W. Grimes.It PASV Ta "prepare for server-to-server transfer"
239ea022d16SRodney W. Grimes.It PORT Ta "specify data connection port"
240ea022d16SRodney W. Grimes.It PWD Ta "print the current working directory"
241ea022d16SRodney W. Grimes.It QUIT Ta "terminate session"
242ea022d16SRodney W. Grimes.It REST Ta "restart incomplete transfer"
243ea022d16SRodney W. Grimes.It RETR Ta "retrieve a file"
244a4b77a2aSPoul-Henning Kamp.It RMD Ta "remove a directory [RW]"
245a4b77a2aSPoul-Henning Kamp.It RNFR Ta "specify rename-from file name [RW]"
246a4b77a2aSPoul-Henning Kamp.It RNTO Ta "specify rename-to file name [RW]"
247ea022d16SRodney W. Grimes.It SITE Ta "non-standard commands (see next section)"
248ea022d16SRodney W. Grimes.It SIZE Ta "return size of file"
249ea022d16SRodney W. Grimes.It STAT Ta "return status of server"
250a4b77a2aSPoul-Henning Kamp.It STOR Ta "store a file [RW]"
251a4b77a2aSPoul-Henning Kamp.It STOU Ta "store a file with a unique name [RW]"
252ea022d16SRodney W. Grimes.It STRU Ta "specify data transfer" Em structure
253ea022d16SRodney W. Grimes.It SYST Ta "show operating system type of server system"
254ea022d16SRodney W. Grimes.It TYPE Ta "specify data transfer" Em type
255ea022d16SRodney W. Grimes.It USER Ta "specify user name"
256ea022d16SRodney W. Grimes.It XCUP Ta "change to parent of current working directory (deprecated)"
257ea022d16SRodney W. Grimes.It XCWD Ta "change working directory (deprecated)"
258a4b77a2aSPoul-Henning Kamp.It XMKD Ta "make a directory (deprecated) [RW]"
259ea022d16SRodney W. Grimes.It XPWD Ta "print the current working directory (deprecated)"
260a4b77a2aSPoul-Henning Kamp.It XRMD Ta "remove a directory (deprecated) [RW]"
261ea022d16SRodney W. Grimes.El
262ea022d16SRodney W. Grimes.Pp
263ea022d16SRodney W. GrimesThe following non-standard or
264ea022d16SRodney W. Grimes.Tn UNIX
265ea022d16SRodney W. Grimesspecific commands are supported
266ea022d16SRodney W. Grimesby the
267ea022d16SRodney W. GrimesSITE request.
268ea022d16SRodney W. Grimes.Pp
269ea022d16SRodney W. Grimes.Bl -column Request -offset indent
270ea022d16SRodney W. Grimes.It Sy Request Ta Sy Description
271ea022d16SRodney W. Grimes.It UMASK Ta change umask, e.g. ``SITE UMASK 002''
272ea022d16SRodney W. Grimes.It IDLE Ta set idle-timer, e.g. ``SITE IDLE 60''
273a4b77a2aSPoul-Henning Kamp.It CHMOD Ta "change mode of a file [RW], e.g. ``SITE CHMOD 755 filename''"
27453ba84a6SPoul-Henning Kamp.It MD5 Ta "report the files MD5 checksum, e.g. ``SITE MD5 filename''"
275e02897faSPhilippe Charnier.It HELP Ta give help information
276ea022d16SRodney W. Grimes.El
277ea022d16SRodney W. Grimes.Pp
2786a01974bSRuslan ErmilovNote: SITE requests are disabled in case of anonymous logins.
2796a01974bSRuslan Ermilov.Pp
280ea022d16SRodney W. GrimesThe remaining ftp requests specified in Internet RFC 959
281ea022d16SRodney W. Grimesare
282ea022d16SRodney W. Grimesrecognized, but not implemented.
283ea022d16SRodney W. GrimesMDTM and SIZE are not specified in RFC 959, but will appear in the
284ea022d16SRodney W. Grimesnext updated FTP RFC.
285ea022d16SRodney W. Grimes.Pp
286ea022d16SRodney W. GrimesThe ftp server will abort an active file transfer only when the
287ea022d16SRodney W. GrimesABOR
288ea022d16SRodney W. Grimescommand is preceded by a Telnet "Interrupt Process" (IP)
289ea022d16SRodney W. Grimessignal and a Telnet "Synch" signal in the command Telnet stream,
290ea022d16SRodney W. Grimesas described in Internet RFC 959.
291ea022d16SRodney W. GrimesIf a
292ea022d16SRodney W. GrimesSTAT
293ea022d16SRodney W. Grimescommand is received during a data transfer, preceded by a Telnet IP
294ea022d16SRodney W. Grimesand Synch, transfer status will be returned.
295ea022d16SRodney W. Grimes.Pp
2963f162cb8SPhilippe CharnierThe
2973f162cb8SPhilippe Charnier.Nm
2983f162cb8SPhilippe Charnierutility interprets file names according to the
299ea022d16SRodney W. Grimes.Dq globbing
300ea022d16SRodney W. Grimesconventions used by
301ea022d16SRodney W. Grimes.Xr csh 1 .
302ea022d16SRodney W. GrimesThis allows users to utilize the metacharacters
303ea022d16SRodney W. Grimes.Dq Li \&*?[]{}~ .
304ea022d16SRodney W. Grimes.Pp
3053f162cb8SPhilippe CharnierThe
3063f162cb8SPhilippe Charnier.Nm
3073f162cb8SPhilippe Charnierutility authenticates users according to six rules.
308ea022d16SRodney W. Grimes.Pp
309ea022d16SRodney W. Grimes.Bl -enum -offset indent
310ea022d16SRodney W. Grimes.It
31142946c82SMike PritchardThe login name must be in the password data base
312ea022d16SRodney W. Grimesand not have a null password.
313ea022d16SRodney W. GrimesIn this case a password must be provided by the client before any
314ea022d16SRodney W. Grimesfile operations may be performed.
315a5a4544eSPaul TrainaIf the user has an S/Key key, the response from a successful USER
31619a05e11SRuslan Ermilovcommand will include an S/Key challenge.
31719a05e11SRuslan ErmilovThe client may choose to respond with a PASS command giving either
31819a05e11SRuslan Ermilova standard password or an S/Key one-time password.
31919a05e11SRuslan ErmilovThe server will automatically determine which type of
32019a05e11SRuslan Ermilovpassword it has been given and attempt to authenticate accordingly.
32119a05e11SRuslan ErmilovSee
322a5a4544eSPaul Traina.Xr key 1
32319a05e11SRuslan Ermilovfor more information on S/Key authentication.
32419a05e11SRuslan ErmilovS/Key is a Trademark of Bellcore.
325ea022d16SRodney W. Grimes.It
326ea022d16SRodney W. GrimesThe login name must not appear in the file
327ea022d16SRodney W. Grimes.Pa /etc/ftpusers .
328ea022d16SRodney W. Grimes.It
32931fea7b8SDavid NugentThe login name must not be a member of a group specified in the file
33031fea7b8SDavid Nugent.Pa /etc/ftpusers .
33131fea7b8SDavid NugentEntries in this file interpreted as group names are prefixed by an "at"
33231fea7b8SDavid Nugent.Ql \&@
33331fea7b8SDavid Nugentsign.
33431fea7b8SDavid Nugent.It
335ea022d16SRodney W. GrimesThe user must have a standard shell returned by
336ea022d16SRodney W. Grimes.Xr getusershell 3 .
337ea022d16SRodney W. Grimes.It
338a5a4544eSPaul TrainaIf the user name appears in the file
33931fea7b8SDavid Nugent.Pa /etc/ftpchroot ,
34031fea7b8SDavid Nugentor the user is a member of a group with a group entry in this file,
34131fea7b8SDavid Nugenti.e. one prefixed with
34231fea7b8SDavid Nugent.Ql \&@ ,
343a5a4544eSPaul Trainathe session's root will be changed to the user's login directory by
344a5a4544eSPaul Traina.Xr chroot 2
345a5a4544eSPaul Trainaas for an
346a5a4544eSPaul Traina.Dq anonymous
347a5a4544eSPaul Trainaor
348a5a4544eSPaul Traina.Dq ftp
349b071c689SDavid Nugentaccount (see next item).
35031fea7b8SDavid NugentThis facility may also be triggered by enabling the boolean "ftp-chroot"
351b071c689SDavid Nugentcapability in
352b071c689SDavid Nugent.Xr login.conf 5 .
353b071c689SDavid NugentHowever, the user must still supply a password.
354ea4e54b9SDavid NugentThis feature is intended as a compromise between a fully anonymous
355ea4e54b9SDavid Nugentaccount and a fully privileged account.
35631fea7b8SDavid NugentThe account should also be set up as for an anonymous account.
357a5a4544eSPaul Traina.It
358ea022d16SRodney W. GrimesIf the user name is
359ea022d16SRodney W. Grimes.Dq anonymous
360ea022d16SRodney W. Grimesor
361ea022d16SRodney W. Grimes.Dq ftp ,
362ea022d16SRodney W. Grimesan
363ea022d16SRodney W. Grimesanonymous ftp account must be present in the password
364ea022d16SRodney W. Grimesfile (user
365ea022d16SRodney W. Grimes.Dq ftp ) .
366ea022d16SRodney W. GrimesIn this case the user is allowed
367ea022d16SRodney W. Grimesto log in by specifying any password (by convention an email address for
368a5a4544eSPaul Trainathe user should be used as the password).
369a5a4544eSPaul TrainaWhen the
3703eb568f2SGuido van Rooij.Fl S
3713eb568f2SGuido van Rooijoption is set, all transfers are logged as well.
372ea022d16SRodney W. Grimes.El
373ea022d16SRodney W. Grimes.Pp
374ea022d16SRodney W. GrimesIn the last case,
375e02897faSPhilippe Charnier.Nm
376ea022d16SRodney W. Grimestakes special measures to restrict the client's access privileges.
377ea022d16SRodney W. GrimesThe server performs a
378ea022d16SRodney W. Grimes.Xr chroot 2
379ea022d16SRodney W. Grimesto the home directory of the
380ea022d16SRodney W. Grimes.Dq ftp
381ea022d16SRodney W. Grimesuser.
382ea022d16SRodney W. GrimesIn order that system security is not breached, it is recommended
383ea022d16SRodney W. Grimesthat the
384ea022d16SRodney W. Grimes.Dq ftp
385ea022d16SRodney W. Grimessubtree be constructed with care, following these rules:
386ea022d16SRodney W. Grimes.Bl -tag -width "~ftp/pub" -offset indent
387ea022d16SRodney W. Grimes.It Pa ~ftp
388ea022d16SRodney W. GrimesMake the home directory owned by
389ea022d16SRodney W. Grimes.Dq root
390ea022d16SRodney W. Grimesand unwritable by anyone.
391ea022d16SRodney W. Grimes.It Pa ~ftp/etc
392ea022d16SRodney W. GrimesMake this directory owned by
393ea022d16SRodney W. Grimes.Dq root
394ea022d16SRodney W. Grimesand unwritable by anyone (mode 555).
395a5a4544eSPaul TrainaThe files pwd.db (see
396a5a4544eSPaul Traina.Xr passwd 5 )
397ea022d16SRodney W. Grimesand
398ea022d16SRodney W. Grimes.Xr group 5
399ea022d16SRodney W. Grimesmust be present for the
4003f162cb8SPhilippe Charnier.Xr ls 1
401ea022d16SRodney W. Grimescommand to be able to produce owner names rather than numbers.
402ea022d16SRodney W. GrimesThe password field in
403ea022d16SRodney W. Grimes.Xr passwd
404ea022d16SRodney W. Grimesis not used, and should not contain real passwords.
405ea022d16SRodney W. GrimesThe file
4067253b58bSGary Palmer.Pa ftpmotd ,
407ea022d16SRodney W. Grimesif present, will be printed after a successful login.
408ea022d16SRodney W. GrimesThese files should be mode 444.
409ea022d16SRodney W. Grimes.It Pa ~ftp/pub
4109ba6d8e4SMike HeffnerThis directory and the subdirectories beneath it should be owned
4119ba6d8e4SMike Heffnerby the users and groups responsible for placing files in them,
4129ba6d8e4SMike Heffnerand be writable only by them (mode 755 or 775).
4139ba6d8e4SMike HeffnerThey should
4149ba6d8e4SMike Heffner.Em not
415a8838c53SRuslan Ermilovbe owned or writable by
416a8838c53SRuslan Ermilov.Dq ftp
417a8838c53SRuslan Ermilovor its group, otherwise guest users
4189ba6d8e4SMike Heffnercan fill the drive with unwanted files.
419ea022d16SRodney W. Grimes.El
420334ab9fdSDavid Nugent.Pp
421ea4e54b9SDavid NugentIf the system has multiple IP addresses,
422e02897faSPhilippe Charnier.Nm
423ea4e54b9SDavid Nugentsupports the idea of virtual hosts, which provides the ability to
424ea4e54b9SDavid Nugentdefine multiple anonymous ftp areas, each one allocated to a different
425ea4e54b9SDavid Nugentinternet address.
426ea4e54b9SDavid NugentThe file
427ea4e54b9SDavid Nugent.Pa /etc/ftphosts
428ea4e54b9SDavid Nugentcontains information pertaining to each of the virtual hosts.
429ea4e54b9SDavid NugentEach host is defined on its own line which contains a number of
430ea4e54b9SDavid Nugentfields separated by whitespace:
431ea4e54b9SDavid Nugent.Bl -tag -offset indent -width hostname
432ea4e54b9SDavid Nugent.It hostname
433ea4e54b9SDavid NugentContains the hostname or IP address of the virtual host.
434ea4e54b9SDavid Nugent.It user
435ea4e54b9SDavid NugentContains a user record in the system password file.
436ea4e54b9SDavid NugentAs with normal anonymous ftp, this user's access uid, gid and group
437ea4e54b9SDavid Nugentmemberships determine file access to the anonymous ftp area.
438ea4e54b9SDavid NugentThe anonymous ftp area (to which any user is chrooted on login)
439ea4e54b9SDavid Nugentis determined by the home directory defined for the account.
440ea4e54b9SDavid NugentUser id and group for any ftp account may be the same as for the
441ea4e54b9SDavid Nugentstandard ftp user.
442ea4e54b9SDavid Nugent.It statfile
443ea4e54b9SDavid NugentFile to which all file transfers are logged, which
444ea4e54b9SDavid Nugentdefaults to
445ea4e54b9SDavid Nugent.Pa /var/log/ftpd .
446ea4e54b9SDavid Nugent.It welcome
447ea4e54b9SDavid NugentThis file is the welcome message displayed before the server ready
448ea4e54b9SDavid Nugentprompt.
449ea4e54b9SDavid NugentIt defaults to
450ea4e54b9SDavid Nugent.Pa /etc/ftpwelcome .
451ea4e54b9SDavid Nugent.It motd
452ea4e54b9SDavid NugentThis file is displayed after the user logs in.
453ea4e54b9SDavid NugentIt defaults to
454ea4e54b9SDavid Nugent.Pa /etc/ftpmotd .
455ea4e54b9SDavid Nugent.El
456ea4e54b9SDavid Nugent.Pp
457d59b62e3SJoseph KoshyLines beginning with a '#' are ignored and can be used to include
458d59b62e3SJoseph Koshycomments.
459d59b62e3SJoseph Koshy.Pp
460ea4e54b9SDavid NugentDefining a virtual host for the primary IP address or hostname
461ea4e54b9SDavid Nugentchanges the default for ftp logins to that address.
462ea4e54b9SDavid NugentThe 'user', 'statfile', 'welcome' and 'motd' fields may be left
463ea4e54b9SDavid Nugentblank, or a single hypen '-' used to indicate that the default
464ea4e54b9SDavid Nugentvalue is to be used.
465ea4e54b9SDavid Nugent.Pp
466ea4e54b9SDavid NugentAs with any anonymous login configuration, due care must be given
467ea4e54b9SDavid Nugentto setup and maintenance to guard against security related problems.
468ea4e54b9SDavid Nugent.Pp
4693f162cb8SPhilippe CharnierThe
470e02897faSPhilippe Charnier.Nm
4713f162cb8SPhilippe Charnierutility has internal support for handling remote requests to list
472334ab9fdSDavid Nugentfiles, and will not execute
473334ab9fdSDavid Nugent.Pa /bin/ls
47417130647SPeter Wemmin either a chrooted or non-chrooted environment.  The
475334ab9fdSDavid Nugent.Pa ~/bin/ls
476334ab9fdSDavid Nugentexecutable need not be placed into the chrooted tree, nor need the
477334ab9fdSDavid Nugent.Pa ~/bin
478334ab9fdSDavid Nugentdirectory exist.
479ea022d16SRodney W. Grimes.Sh FILES
480ea022d16SRodney W. Grimes.Bl -tag -width /etc/ftpwelcome -compact
481ea022d16SRodney W. Grimes.It Pa /etc/ftpusers
482ea022d16SRodney W. GrimesList of unwelcome/restricted users.
483a5a4544eSPaul Traina.It Pa /etc/ftpchroot
484a5a4544eSPaul TrainaList of normal users who should be chroot'd.
485f97d7807SDavid E. O'Brien.It Pa /etc/ftphosts
486f97d7807SDavid E. O'BrienVirtual hosting configuration file.
487ea022d16SRodney W. Grimes.It Pa /etc/ftpwelcome
488ea022d16SRodney W. GrimesWelcome notice.
4897253b58bSGary Palmer.It Pa /etc/ftpmotd
490ea022d16SRodney W. GrimesWelcome notice after login.
4910e510aedSSatoshi Asami.It Pa /var/run/nologin
492ea022d16SRodney W. GrimesDisplayed and access refused.
4933eb568f2SGuido van Rooij.It Pa /var/log/ftpd
4943eb568f2SGuido van RooijLog file for anonymous transfers.
495ea022d16SRodney W. Grimes.El
496ea022d16SRodney W. Grimes.Sh SEE ALSO
497ea022d16SRodney W. Grimes.Xr ftp 1 ,
498a5a4544eSPaul Traina.Xr key 1 ,
49938ed70b1SYaroslav Tykhiy.Xr umask 2 ,
500ea022d16SRodney W. Grimes.Xr getusershell 3 ,
501b071c689SDavid Nugent.Xr login.conf 5 ,
502cf09a206SDavid Greenman.Xr inetd 8 ,
503ea022d16SRodney W. Grimes.Xr syslogd 8
504ea022d16SRodney W. Grimes.Sh BUGS
505ea022d16SRodney W. GrimesThe server must run as the super-user
506ea022d16SRodney W. Grimesto create sockets with privileged port numbers.  It maintains
507ea022d16SRodney W. Grimesan effective user id of the logged in user, reverting to
508ea022d16SRodney W. Grimesthe super-user only when binding addresses to sockets.  The
509ea022d16SRodney W. Grimespossible security holes have been extensively
510ea022d16SRodney W. Grimesscrutinized, but are possibly incomplete.
511ea022d16SRodney W. Grimes.Sh HISTORY
512ea022d16SRodney W. GrimesThe
513ea022d16SRodney W. Grimes.Nm
5143f162cb8SPhilippe Charnierutility appeared in
515ea022d16SRodney W. Grimes.Bx 4.2 .
5164dd8b5abSYoshinobu InoueIPv6 support was added in WIDE Hydrangea IPv6 stack kit.
517