xref: /original-bsd/libexec/ftpd/ftpd.8 (revision 95a66346)
1.\" Copyright (c) 1985, 1988, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)ftpd.8	6.9 (Berkeley) 03/16/91
7.\"
8.Dd
9.Dt FTPD 8
10.Os BSD 4.2
11.Sh NAME
12.Nm ftpd
13.Nd
14.Tn DARPA
15Internet File Transfer Protocol server
16.Sh SYNOPSIS
17.Nm ftpd
18.Op Fl d
19.Op Fl l
20.Op Fl t Ar timeout
21.Op Fl T Ar maxtimeout
22.Sh DESCRIPTION
23.Nm Ftpd
24is the
25.Tn DARPA
26Internet File Transfer Protocol
27server process.  The server uses the
28.Tn TCP
29protocol
30and listens at the port specified in the
31.Dq ftp
32service specification; see
33.Xr services 5 .
34.Pp
35Available options:
36.Bl -tag -width Ds
37.It Fl d
38Debugging information is written to the syslog.
39.It Fl l
40Each
41.Xr ftp 1
42session is logged in the syslog.
43.It Fl t
44The inactivity timeout period is set to
45.Ar timeout
46seconds (the default is 15 minutes).
47.It Fl T
48A client may also request a different timeout period;
49the maximum period allowed may be set to
50.Ar timeout
51seconds with the
52.Fl T
53option.
54The default limit is 2 hours.
55.El
56.Pp
57The ftp server currently supports the following ftp
58requests; case is not distinguished.
59.Bl -column "Request" -offset indent
60.It Request Ta "Description"
61.It ABOR Ta "abort previous command"
62.It ACCT Ta "specify account (ignored)"
63.It ALLO Ta "allocate storage (vacuously)"
64.It APPE Ta "append to a file"
65.It CDUP Ta "change to parent of current working directory"
66.It CWD Ta "change working directory"
67.It DELE Ta "delete a file"
68.It HELP Ta "give help information"
69.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA"
70.It MKD Ta "make a directory"
71.It MDTM Ta "show last modification time of file"
72.It MODE Ta "specify data transfer" Em mode
73.It NLST Ta "give name list of files in directory"
74.It NOOP Ta "do nothing"
75.It PASS Ta "specify password"
76.It PASV Ta "prepare for server-to-server transfer"
77.It PORT Ta "specify data connection port"
78.It PWD Ta "print the current working directory"
79.It QUIT Ta "terminate session"
80.It REST Ta "restart incomplete transfer"
81.It RETR Ta "retrieve a file"
82.It RMD Ta "remove a directory"
83.It RNFR Ta "specify rename-from file name"
84.It RNTO Ta "specify rename-to file name"
85.It SITE Ta "non-standard commands (see next section)"
86.It SIZE Ta "return size of file"
87.It STAT Ta "return status of server"
88.It STOR Ta "store a file"
89.It STOU Ta "store a file with a unique name"
90.It STRU Ta "specify data transfer" Em structure
91.It SYST Ta "show operating system type of server system"
92.It TYPE Ta "specify data transfer" Em type
93.It USER Ta "specify user name"
94.It XCUP Ta "change to parent of current working directory (deprecated)"
95.It XCWD Ta "change working directory (deprecated)"
96.It XMKD Ta "make a directory (deprecated)"
97.It XPWD Ta "print the current working directory (deprecated)"
98.It XRMD Ta "remove a directory (deprecated)"
99.El
100.Pp
101The following non-standard or
102.Tn UNIX
103specific commands are supported
104by the
105SITE request.
106.Pp
107.Bl -column Request -offset indent
108.It Sy Request Ta Sy Description
109.It UMASK Ta change umask. Em E.g. SITE UMASK 002
110.It IDLE Ta set idle-timer. Em E.g. SITE IDLE 60
111.It CHMOD Ta change mode of a file. Em E.g.
112SITE CHMOD 755 filename
113.It HELP Ta give help information. Em E.g. SITE HELP
114.El
115.Pp
116The remaining ftp requests specified in Internet
117.%T "RFC 959"
118are
119recognized, but not implemented.
120MDTM and SIZE are not specified in
121.%T "RFC 959" ,
122but will appear in the next updated FTP RFC.
123.Pp
124The ftp server will abort an active file transfer only when the
125ABOR
126command is preceded by a Telnet "Interrupt Process" (IP)
127signal and a Telnet "Synch" signal in the command Telnet stream,
128as described in Internet
129.%T "RFC 959" .
130If a
131STAT
132command is received during a data transfer, preceded by a Telnet IP
133and Synch, transfer status will be returned.
134.Pp
135.Nm Ftpd
136interprets file names according to the
137.Dq globbing
138conventions used by
139.Xr csh 1 .
140This allows users to utilize the metacharacters
141.Dq Li \&*?[]{}~ .
142.Pp
143.Nm Ftpd
144authenticates users according to three rules.
145.Pp
146.Bl -enum -offset indent
147.It
148The user name must be in the password data base,
149.Pa /etc/passwd ,
150and not have a null password.  In this case a password
151must be provided by the client before any file operations
152may be performed.
153.It
154The user name must not appear in the file
155.Pa /etc/ftpusers .
156.It
157The user must have a standard shell returned by
158.Xr getusershell 3 .
159.It
160If the user name is
161.Dq anonymous
162or
163.Dq ftp ,
164an
165anonymous ftp account must be present in the password
166file (user
167.Dq ftp ) .
168In this case the user is allowed
169to log in by specifying any password (by convention this
170is given as the client host's name).
171.El
172.Pp
173In the last case,
174.Nm ftpd
175takes special measures to restrict the client's access privileges.
176The server performs a
177.Xr chroot 2
178command to the home directory of the
179.Dq ftp
180user.
181In order that system security is not breached, it is recommended
182that the
183.Dq ftp
184subtree be constructed with care;  the following
185rules are recommended.
186.Bl -tag -width "~ftp/pub" -offset indent
187.It Pa ~ftp
188Make the home directory owned by
189.Dq ftp
190and unwritable by anyone.
191.It Pa ~ftp/bin
192Make this directory owned by the super-user and unwritable by
193anyone.  The program
194.Xr ls 1
195must be present to support the list command.  This
196program should have mode 111.
197.It Pa ~ftp/etc
198Make this directory owned by the super-user and unwritable by
199anyone.  The files
200.Xr passwd 5
201and
202.Xr group 5
203must be present for the
204.Xr ls
205command to be able to produce owner names rather than numbers.
206The password field in
207.Xr passwd
208is not used, and should not contain real encrypted passwords.
209These files should be mode 444.
210.It Pa ~ftp/pub
211Make this directory mode 777 and owned by
212.Dq ftp .
213Users
214should then place files which are to be accessible via the
215anonymous account in this directory.
216.El
217.Sh SEE ALSO
218.Xr ftp 1 ,
219.Xr getusershell 3 ,
220.Xr syslogd 8
221.Sh BUGS
222The anonymous account is inherently dangerous and should
223avoided when possible.
224.Pp
225The server must run as the super-user
226to create sockets with privileged port numbers.  It maintains
227an effective user id of the logged in user, reverting to
228the super-user only when binding addresses to sockets.  The
229possible security holes have been extensively
230scrutinized, but are possibly incomplete.
231.Sh HISTORY
232The
233.Nm
234command appeared in
235.Bx 4.2 .
236