Debian Codegraph @

doc/modules/mod_auth.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD module mod_auth</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr>
10 <center>
11 <h2><b>ProFTPD module <code>mod_auth</code></b></h2>
12 </center>
13 <hr><br>
14
15 <p>
16 This module is contained in the <code>mod_auth.c</code> file for
17 ProFTPD 1.3.<i>x</i>, and is compiled by default.
18
19 <h2>Directives</h2>
20 <ul>
21 <li><a href="#AccessDenyMsg">AccessDenyMsg</a>
22 <li><a href="#AccessGrantMsg">AccessGrantMsg</a>
23 <li><a href="#AllowChrootSymlinks">AllowChrootSymlinks</a>
24 <li><a href="#AllowEmptyPasswords">AllowEmptyPasswords</a>
25 <li><a href="#AnonAllowRobots">AnonAllowRobots</a>
26 <li><a href="#AnonRejectPasswords">AnonRejectPasswords</a>
27 <li><a href="#AnonRequirePassword">AnonRequirePassword</a>
28 <li><a href="#AuthAliasOnly">AuthAliasOnly</a>
29 <li><a href="#AuthUsingAlias">AuthUsingAlias</a>
30 <li><a href="#CreateHome">CreateHome</a>
31 <li><a href="#DefaultChdir">DefaultChdir</a>
32 <li><a href="#DefaultRoot">DefaultRoot</a>
33 <li><a href="#DisplayLogin">DisplayLogin</a>
34 <li><a href="#MaxClients">MaxClients</a>
35 <li><a href="#MaxClientsPerClass">MaxClientsPerClass</a>
36 <li><a href="#MaxClientsPerHost">MaxClientsPerHost</a>
37 <li><a href="#MaxClientsPerUser">MaxClientsPerUser</a>
38 <li><a href="#MaxConnectionsPerHost">MaxConnectionsPerHost</a>
39 <li><a href="#MaxHostsPerUser">MaxHostsPerUser</a>
40 <li><a href="#MaxLoginAttempts">MaxLoginAttempts</a>
41 <li><a href="#MaxPasswordSize">MaxPasswordSize</a>
42 <li><a href="#RequireValidShell">RequireValidShell</a>
43 <li><a href="#RewriteHome">RewriteHome</a>
44 <li><a href="#RootLogin">RootLogin</a>
45 <li><a href="#RootRevoke">RootRevoke</a>
46 <li><a href="#TimeoutLogin">TimeoutLogin</a>
47 <li><a href="#TimeoutSession">TimeoutSession</a>
48 <li><a href="#UseFtpUsers">UseFtpUsers</a>
49 <li><a href="#UseLastlog">UseLastlog</a>
50 <li><a href="#UserAlias">UserAlias</a>
51 <li><a href="#UserPassword">UserPassword</a>
52 <li><a href="#WtmpLog">WtmpLog</a>
53 </ul>
54
55 <p>
56 <hr>
57 <h3><a name="AccessDenyMsg">AccessDenyMsg</a></h3>
58 <strong>Syntax:</strong> AccessDenyMsg <em>message</em><br>
59 <strong>Default:</strong> None<br>
60 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
61 <strong>Module:</strong> mod_auth<br>
62 <strong>Compatibility:</strong> 1.2.2 and later
63
64 <p>
65 When an FTP client attempts to authenticate and fails, the client is sent the
66 following FTP response:
67 <pre>
68 530 Login failed
69 </pre>
70 This "Login failed" response message can be replaced/customized by using this
71 <code>AccessDenyMsg</code> directive. In the configured <em>message</em>
72 text, the <code>%u</code> variable will be resolved to the user name used by
73 the FTP client in its authentication attempt.
74
75 <p>
76 Example:
77 <pre>
78 AccessDenyMsg "%u is not authorized"
79 </pre>
80
81 <p>
82 <hr>
83 <h3><a name="AccessGrantMsg">AccessGrantMsg</a></h3>
84 <strong>Syntax:</strong> AccessGrantMsg <em>message</em><br>
85 <strong>Default:</strong> None<br>
86 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
87 <strong>Module:</strong> mod_auth<br>
88 <strong>Compatibility:</strong> 1.2.2 and later
89
90 <p>
91 When an FTP client succeeds in authenticating, it will receive an FTP response
92 with the 230 response code, and a message. This successful authentication
93 response message can be replaced/customized by using this
94 <code>AccessGrantMsg</code> directive. In the configured <em>message</em>
95 text, the <code>%u</code> variable will be resolved to the user name used by
96 the FTP client in its authentication attempt.
97
98 <p>
99 Example:
100 <pre>
101 AccessGrantMsg "Welcome, %u!"
102 </pre>
103
104 <hr>
105 <h3><a name="AllowChrootSymlinks">AllowChrootSymlinks</a></h3>
106 <strong>Syntax:</strong> AllowChrootSymlinks <em>on|off</em><br>
107 <strong>Default:</strong> AllowChrootSymlinks on<br>
108 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
109 <strong>Module:</strong> mod_auth<br>
110 <strong>Compatibility:</strong> 1.3.5rc1 and later
111
112 <p>
113 The <code>AllowChrootSymlinks</code> directive configures whether
114 <code>proftpd</code> will follow a symlink to the destination directory
115 when performing a <code>chroot(2)</code> call. This applies both to
116 <a href="#DefaultRoot"><code>DefaultRoot</code></a> directives <b>and</b> to
117 <code>&lt;Anonymous&gt;</code> sections.
118
119 <p>
120 <b>Security note</b>: If you permit your users the ability to remove
121 directories which might be FTP users' home directories (<i>or</i>
122 <code>&lt;Anonymous&gt;</code> directories) and create symlinks, then you
123 <b>should</b> use:
124 <pre>
125 AllowChrootSymlinks off
126 </pre>
127 This includes sites which are hosting providers, <i>i.e.</i> which allow
128 users to run their untrusted webapps (<i>e.g.</i> PHP, Perl, Ruby, Python,
129 <i>etc</i> apps) on the servers.
130
131 <p>
132 <hr>
133 <h3><a name="AllowEmptyPasswords">AllowEmptyPasswords</a></h3>
134 <strong>Syntax:</strong> AllowEmptyPasswords <em>on|off</em><br>
135 <strong>Default:</strong> AllowEmptyPasswords on<br>
136 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
137 <strong>Module:</strong> mod_auth<br>
138 <strong>Compatibility:</strong> 1.3.6rc2 and later
139
140 <p>
141 The <code>AllowEmptyPasswords</code> directive configures whether
142 <code>proftpd</code> will accept empty passwords or not. For backward
143 compatibility, the default is <em>on</em>.
144
145 <p>
146 <b>Note</b> that this applies to <code>mod_sftp</code> password-based logins
147 as well.
148
149 <p>
150 <hr>
151 <h3><a name="AnonAllowRobots">AnonAllowRobots</a></h3>
152 <strong>Syntax:</strong> AnonAllowRobots <em>on|off</em><br>
153 <strong>Default:</strong> AnonAllowRobots off<br>
154 <strong>Context:</strong> <code>&lt;Anonymous&gt;</code><br>
155 <strong>Module:</strong> mod_auth<br>
156 <strong>Compatibility:</strong> 1.3.6rc2 and later
157
158 <p>
159 The <code>AnonAllowRobots</code> directive configures whether the
160 <code>mod_auth</code> should provide a fake
161 <a href="http://www.robotstxt.org/">"robots.txt"</a> file to web
162 crawlers/spiders.
163
164 <p>
165 Normally such web crawlers/spiders make HTTP requests only. However,
166 <a href="https://developers.google.com/webmasters/control-crawl-index/docs/robots_txt#file-location--range-of-validity">Google</a> <em>is</em> known to crawl
167 FTP sites, using anonymous logins only.
168
169 <p>
170 To prevent such web crawlers from indexing your FTP site unexpectedly,
171 the <code>mod_auth</code> module will automatically provide a fake "robots.txt"
172 file for anonymous logins, containing:
173 <pre>
174 User-agent: *
175 Disallow: /
176 </pre>
177
178 <p>
179 If your FTP site <i>deliberately</i> provides its own separate "robots.txt"
180 file already, then <code>mod_auth</code> will serve that existing file as
181 expected. Alternatively, you can disable this behavior using:
182 <pre>
183 # Restore previous behavior
184 AnonAllowRobots on
185 </pre>
186
187 <p>
188 <hr>
189 <h3><a name="AnonRejectPasswords">AnonRejectPasswords</a></h3>
190 <strong>Syntax:</strong> AnonRejectPasswords <em>pattern [flags]</em><br>
191 <strong>Default:</strong> None<br>
192 <strong>Context:</strong> <code>&lt;Anonymous&gt;</code><br>
193 <strong>Module:</strong> mod_auth<br>
194 <strong>Compatibility:</strong> 1.2.9rc1 and later
195
196 <p>
197 The <code>AnonRejectPasswords</code> directive configures a regular expression
198 <em>pattern</em> filter for passwords given for anonymous logins. If the
199 given anonymous password matches the configured regular expression
200 <em>pattern</em>, the anonymous login is denied.
201
202 <p>
203 Example:
204 <pre>
205 # Reject all &lt;Anonymous&gt; logins that use "evil.org" as part of the password
206 AnonRejectPasswords @evil\.org$
207 </pre>
208
209 <p>
210 The optional <em>flags</em> parameter can be used to specify flags for the
211 given regular expression; currently the supported flags are:
212 <ul>
213 <li><code>[NC|nocase]</code>
214 </ul>
215 Thus for a case-insensitive pattern, you would use:
216 <pre>
217 # Reject all &lt;Anonymous&gt; logins that use "evil.org" as part of the password
218 AnonRejectPasswords @evil\.org$ [NC]
219 </pre>
220 or:
221 <pre>
222 # Reject all &lt;Anonymous&gt; logins that use "evil.org" as part of the password
223 AnonRejectPasswords @evil\.org$ [nocase]
224 </pre>
225
226 <p>
227 If you want to reject any anonymous passwords which do <b>not</b> match the
228 pattern, then prefix your pattern with the <code>!</code> (exclamation point)
229 character:
230 <pre>
231 # Reject all &lt;Anonymous&gt; logins that do NOT use "good.org" as part of the password
232 AnonRejectPasswords !@good\.org$ [nocase]
233 </pre>
234 <b>Note</b> that this also allows you to use <code>AnonRejectPasswords</code>
235 to <b>require</b> that your anonymous logins use email-like passwords:
236 <pre>
237 # Require anonymous passwords that look like email addresses. See:
238 # <a href="http://www.regular-expressions.info/email.html">http://www.regular-expressions.info/email.html</a>
239 AnonRejectPasswords !^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$ [NC]
240 </pre>
241
242 <p>
243 <hr>
244 <h3><a name="AnonRequirePassword">AnonRequirePassword</a></h3>
245 <strong>Syntax:</strong> AnonRequirePassword <em>off|on</em><br>
246 <strong>Default:</strong> AnonRequirePassword off<br>
247 <strong>Context:</strong> <code>&lt;Anonymous&gt;</code><br>
248 <strong>Module:</strong> mod_auth<br>
249 <strong>Compatibility:</strong> 0.99.0 and later
250
251 <p>
252 Normally, anonymous FTP logins do not require the client to authenticate
253 themselves using <em>real</em> passwords; instead, anonymous FTP logins are
254 expected to provide their email address as the password. Using
255 <code>AnonRequirePassword on</code>, however, will <i>require</i> a real
256 password for that login. The provided password will be matched against the
257 <code>&lt;Anonymous&gt;</code> user's password.
258
259 <p>
260 This functionality, in conjunction with the <code>AuthUsingAlias</code>
261 directive, can be used to create "guest" accounts, which function exactly as
262 normal anonymous logins do, <b>but</b> which require a valid password on the
263 server's host system.
264
265 <p>
266 See also: <a href="#AuthUsingAlias"><code>AuthUsingAlias</code></a>, <a href="#UserAlias"><code>UserAlias</code></a>
267
268 <p>
269 <hr>
270 <h3><a name="AuthAliasOnly">AuthAliasOnly</a></h3>
271 <strong>Syntax:</strong> AuthAliasOnly <em>off|on</em><br>
272 <strong>Default:</strong> AuthAliasOnly off<br>
273 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
274 <strong>Module:</strong> mod_auth<br>
275 <strong>Compatibility:</strong> 1.1.3 and later
276
277 <p>
278 The <code>AuthAliasOnly</code> directive restricts authentication to "aliased"
279 logins only, <i>i.e.</i> those usernames provided by clients which are "mapped"
280 to a <em>real</em> username by the <code>UserAlias</code> directive. Using
281 <code>AuthAliasOnly on</code> in a particular configuration context will
282 cause ProFTPD to completely ignore all <em>non-aliased</em> logins for the
283 entire context.
284
285 <p>
286 See also: <a href="#AuthUsingAlias"><code>AuthUsingAlias</code></a>, <a href="#UserAlias"><code>UserAlias</code></a>
287
288 <p>
289 <hr>
290 <h3><a name="AuthUsingAlias">AuthUsingAlias</a></h3>
291 <strong>Syntax:</strong> AuthUsingAlias <em>off|on</em><br>
292 <strong>Default:</strong> AuthUsingAlias off<br>
293 <strong>Context:</strong> <code>&lt;Anonymous&gt;</code><br>
294 <strong>Module:</strong> mod_auth<br>
295 <strong>Compatibility:</strong> 1.2.0pre9 and later
296
297 <p>
298 The <code>AuthUsingAlias</code> directive disables the resolving of aliased usernames (via <code>UserAlias</code>) for authentication purposes. For example,
299 if you have aliased the username "anonymous" to the real user "ftp", the
300 password gets checked against the user "anonymous". When
301 <code>AuthUsingAlias</code> is <em>disabled</em>, the checked username would
302 be "ftp".
303
304 <p>
305 Here is an example of an <code>&lt;Anonymous&gt;</code> section where only
306 the aliased usernames are allowed to login:
307 <pre>
308 &lt;Anonymous ~ftp&gt;
309 AuthUsingAlias on
310 UserAlias anonymous nobody
311 UserAlias ftp nobody
312
313 # Make this a read-only anonymous login
314 &lt;Limit WRITE&gt;
315 DenyAll
316 &lt;/Limit&gt;
317 &lt;/Anonymous&gt;
318 </pre>
319 and here, by contrast, is an <code>&lt;Anonymous&gt;</code> section where
320 certain real users are allowed to login <i>using their own passwords</i> (even
321 though it will still be considered an <i>anonymous</i> login):
322 <pre>
323 &lt;Anonymous ~ftp&gt;
324 # Require real passwords for these logins
325 AnonRequirePassword on
326
327 AuthAliasOnly on
328 AuthUsingAlias on
329
330 # This is the list of authorized users; password checks will occur
331 # using their own respective passwords, not user "nobody".
332 UserAlias fred nobody
333 UserAlias jenn nobody
334 &lt;/Anonymous&gt;
335 </pre>
336
337 <p>
338 See also: <a href="#AnonRequirePassword"><code>AnonRequirePassword</code></a>, <a href="#UserAlias"><code>UserAlias</code></a>
339
340 <p>
341 <hr>
342 <h3><a name="CreateHome">CreateHome</a></h3>
343 <strong>Syntax:</strong> CreateHome <em>off|on [mode] [skel path] [dirmode mode]...</em><br>
344 <strong>Default:</strong> None<br>
345 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
346 <strong>Module:</strong> mod_auth<br>
347 <strong>Compatibility:</strong> 1.2.8rc2 and later
348
349 <p>
350 The <code>CreateHome</code> directive configures the server to automatically
351 create a user's home directory, if that directory does not exist, during the
352 login process.
353
354 <p>
355 The <em>mode</em> parameter is used to configure the absolute mode of the home
356 directory created. If not specified, the mode will default to 700.
357
358 <p>
359 The optional <em>skel path</em> parameters can be used to configure an
360 <code>/etc/skel</code>-like directory containing account initialization files
361 and directories. The parameter must be the full path to the skeleton directory.
362 The directory must <b>not</b> be world-writeable. Files copied from this
363 directory into the new home directory will have ownership set to the UID and
364 GID of the logging-in user. Note that sockets and FIFOs in the skeleton
365 directory will <b>not</b> be copied; any setuid or setgid bits on files will be
366 removed from the copied files in the target home directory.
367
368 <p>
369 The optional <em>dirmode</em> parameter can be used to specify the mode for
370 intermediate directories that may need to be created in order to create the
371 target home directory. By default, the mode for such intermediate directories
372 will be 711. <b>Note</b>: using a mode that does not include the execute bit to
373 be enabled can cause havoc. <b><i>You have been warned.</i></b>
374
375 <p>
376 Examples:
377 <pre>
378 # Use the CreateHome default settings
379 CreateHome on
380
381 # Specify a skeleton directory
382 CreateHome on skel /etc/ftpd/skel
383
384 # No skeleton, but make sure that intermediate directories have 755
385 # permissions.
386 CreateHome on dirmode 755
387
388 # Skeleton directory, with 700 intermediate directories
389 CreateHome on skel /etc/ftpd/skel dirmode 700
390 </pre>
391
392 <p>
393 A fuller description of the <code>CreateHome</code> directive and its uses,
394 with more examples, can be read <a href="../howto/CreateHome.html">here</a>.
395
396 <p>
397 <hr>
398 <h3><a name="DefaultChdir">DefaultChdir</a></h3>
399 <strong>Syntax:</strong> DefaultChdir <em>path [group-expression]</em><br>
400 <strong>Default:</strong> None<br>
401 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
402 <strong>Module:</strong> mod_auth<br>
403 <strong>Compatibility:</strong> 1.2.0rc1
404
405 <p>
406 The <code>DefaultChdir</code> directive determines the directory <em>path</em>
407 into which a user is placed, after logging in.
408
409 <p>
410 By default, the user is put into their home directory. The specified
411 <em>path</em> can be relative to the user's home directory. <b>Note</b> that
412 if the specified <em>path</em> is not available, then <code>DefaultChdir</code>
413 will be ignored; the direction in which the user is placed will be determined
414 by other directives.
415
416 <p>
417 Examples:
418 <pre>
419 # Admin users start off in /var/www
420 DefaultChdir /var/www admin
421
422 # ..and others start off in their respective public FTP folders
423 DefaultChdir ~/public_ftp
424 </pre>
425
426 <p>
427 See also: <a href="#DefaultRoot"><code>DefaultRoot</code></a>
428
429 <p>
430 <hr>
431 <h3><a name="DefaultRoot">DefaultRoot</a></h3>
432 <strong>Syntax:</strong> DefaultRoot <em>path [group-expression]</em><br>
433 <strong>Default:</strong> None<br>
434 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
435 <strong>Module:</strong> mod_auth<br>
436 <strong>Compatibility:</strong> 1.2.0rc1
437
438 <p>
439 The <code>DefaultRoot</code> directive is used to <code>chroot()</code> the
440 session process for the connecting client. A fuller explanation can be
441 found in the <a href="../howto/Chroot.html">Chroot</a> howto.
442
443 <p>
444 <hr>
445 <h3><a name="DisplayLogin">DisplayLogin</a></h3>
446 <strong>Syntax:</strong> DisplayLogin <em>path</em><br>
447 <strong>Default:</strong> None<br>
448 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
449 <strong>Module:</strong> mod_auth<br>
450 <strong>Compatibility:</strong> 0.99.0
451
452 <p>
453 The <code>DisplayLogin</code> directive specifies a file <em>path</em> which
454 will be displayed to the user when they initially login. The <em>path</em>
455 can be either relative or absolute. For relative <em>paths</em>, the file is
456 searched for in the initial directory in which a user is placed immediately
457 after authentication, <i>e.g.</i> the home directory for normal users, or
458 the <code>&lt;Anonymous&gt;</code> directory for anonymous logins. If the file
459 cannot be found or accessed, no error occurs and nothing is displayed to the
460 client.
461
462 <p>
463 The <a href="../howto/DisplayFiles.html">DisplayFiles</a> howto covers such
464 files in greater detail.
465
466 <p>
467 <hr>
468 <h3><a name="MaxClients">MaxClients</a></h3>
469 <strong>Syntax:</strong> MaxClients <em>count|"none" [message]</em><br>
470 <strong>Default:</strong> None<br>
471 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
472 <strong>Module:</strong> mod_auth<br>
473 <strong>Compatibility:</strong> 0.99.0 and later
474
475 <p>
476 The <code>MaxClients</code> directive configures the maximum number of
477 <b>authenticated</b> clients which may be logged into a server or
478 <code>&lt;Anonymous&gt;</code> account. Once the <em>count</em> limit is
479 reached, additional clients attempting to authenticate will be disconnected.
480 The special <em>count</em> parameter value of <em>"none"</em> may be used,
481 which disables all other applicable <code>MaxClients</code> directives.
482
483 <p>
484 Additionally, an optional <em>message</em> parameter may be used; this message
485 will be displayed to a client attempting to exceed the maximum value,
486 immediately before disconnection. The <em>message</em> parameter is parsed for
487 the variable "%m", which is replaced with the configured maximum value. If
488 a message is not supplied, then following default message is used:
489 <pre>
490 "Sorry, the maximum number of allowed clients (%m) are already connected."
491 </pre>
492
493 <p>
494 For example, using:
495 <pre>
496 MaxClients 5
497 </pre>
498 will result in this FTP response, when the limit is reached:
499 <pre>
500 "530 Sorry, the maximum number of allowed users are already connected (5)"
501 </pre>
502
503 <p>
504 See also: <a href="#MaxClientsPerClass"><code>MaxClientsPerClass</code></a>,
505 <a href="#MaxClientsPerHost"><code>MaxClientsPerHost</code></a>,
506 <a href="#MaxClientsPerUser"><code>MaxClientsPerUser</code></a>,
507 <a href="#MaxHostsPerUser"><code>MaxHostsPerUser</code></a>
508
509 <p>
510 <hr>
511 <h3><a name="MaxClientsPerClass">MaxClientsPerClass</a></h3>
512 <strong>Syntax:</strong> MaxClientsPerClass <em>class count|"none" [message]</em><br>
513 <strong>Default:</strong> None<br>
514 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
515 <strong>Module:</strong> mod_auth<br>
516 <strong>Compatibility:</strong> 1.2.10rc1 and later
517
518 <p>
519 The <code>MaxClientsPerClass</code> directive configures the maximum number of
520 clients that may be connected at any given time from the same
521 <a href="../howto/Classes.html">Class</a>. The optional <em>message</em>
522 parameter may be used, which will be displayed to a client attempting to exceed
523 the <em>count</em> maximum value. If <em>message</em> is not supplied,
524 then the following default message is used:
525 <pre>
526 "Sorry, the maximum number of clients (%m) from your class are already connected."
527 </pre>
528
529 <p>
530 For example:
531 <pre>
532 MaxClientsPerClass foo 1 "Only one such client at a time."
533 </pre>
534 results in this FTP response, to a client exceeding the limit:
535 <pre>
536 "530 Only one such client at a time."
537 </pre>
538
539 <p>
540 See also: <a href="#MaxClients"><code>MaxClients</code></a>,
541 <a href="#MaxClientsPerHost"><code>MaxClientsPerHost</code></a>,
542 <a href="#MaxClientsPerUser"><code>MaxClientsPerUser</code></a>,
543 <a href="#MaxHostsPerUser"><code>MaxHostsPerUser</code></a>
544
545 <p>
546 <hr>
547 <h3><a name="MaxClientsPerHost">MaxClientsPerHost</a></h3>
548 <strong>Syntax:</strong> MaxClientsPerHost <em>count|"none" [message]</em><br>
549 <strong>Default:</strong> None<br>
550 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
551 <strong>Module:</strong> mod_auth<br>
552 <strong>Compatibility:</strong> 1.1.7 and later
553
554 <p>
555 The <code>MaxClientsPerHost</code> directive configures the maximum number of
556 clients allowed to connect <i>from</i> a host. The optional <em>message</em>
557 parameter may be used, which will be displayed to a client attempting to exceed
558 the <em>count</em> maximum value. If <em>message</em> is not supplied, this
559 default message is used:
560 <pre>
561 "Sorry, the maximum number clients (%m) from your host are already connected." is used.
562 </pre>
563
564 <p>
565 For example:
566 <pre>
567 MaxClientsPerHost 1 "Sorry, you may not connect more than one time."
568 </pre>
569 results in this FTP response, to a client exceeding the limit:
570 <pre>
571 "530 Sorry, you may not connect more than one time."
572 </pre>
573
574 <p>
575 See also: <a href="#MaxClients"><code>MaxClients</code></a>,
576 <a href="#MaxClientsPerClass"><code>MaxClientsPerClass</code></a>,
577 <a href="#MaxClientsPerUser"><code>MaxClientsPerUser</code></a>,
578 <a href="#MaxHostsPerUser"><code>MaxHostsPerUser</code></a>
579
580 <p>
581 <hr>
582 <h3><a name="MaxClientsPerUser">MaxClientsPerUser</a></h3>
583 <strong>Syntax:</strong> MaxClientsPerUser <em>count|"none" [message]</em><br>
584 <strong>Default:</strong> None<br>
585 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
586 <strong>Module:</strong> mod_auth<br>
587 <strong>Compatibility:</strong> 1.2.7rc1 and later
588
589 <p>
590 The <code>MaxClientsPerUser</code> directive configures the maximum number of
591 clients that may be connected at any given time <i>using the same user name</i>.
592 The optional <em>message</em> parameter may be used, which will be displayed to
593 a client attempting to exceed the <em>count</em> maximum value. If
594 <em>message</em> is not supplied, the following default message is used:
595 <pre>
596 "Sorry, the maximum number of clients (%m) for this user already connected."
597 </pre>
598
599 <p>
600 For example:
601 <pre>
602 MaxClientsPerUser 1 "Only one such user at a time."
603 </pre>
604 results in this FTP response, to a client exceeding the limit:
605 <pre>
606 "530 Only one such user at a time."
607 </pre>
608
609 <p>
610 See also: <a href="#MaxClients"><code>MaxClients</code></a>,
611 <a href="#MaxClientsPerClass"><code>MaxClientsPerClass</code></a>,
612 <a href="#MaxClientsPerHost"><code>MaxClientsPerHost</code></a>,
613 <a href="#MaxHostsPerUser"><code>MaxHostsPerUser</code></a>
614
615 <p>
616 <hr>
617 <h3><a name="MaxConnectionsPerHost">MaxConnectionsPerHost</a></h3>
618 <strong>Syntax:</strong> MaxConnectionsPerHost <em>count|"none" [message]</em><br>
619 <strong>Default:</strong> None<br>
620 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
621 <strong>Module:</strong> mod_auth<br>
622 <strong>Compatibility:</strong> 1.2.11 and later
623
624 <p>
625 The <code>MaxConnectionsPerHost</code> directive configures the maximum number
626 of <b>unauthenticated</b> clients allowed to connect from a given host. The
627 optional <em>message</em> parameter may be used, to be displayed to a client
628 attempting to exceed the maximum value. If <em>message</em> is not supplied,
629 a default message of "Sorry, the maximum number of connections (%m) from your host are already connected." is used.
630
631 <p>
632 For example:
633 <pre>
634 MaxConnectionsPerHost 1 "Sorry, you may not connect more than one time."
635 </pre>
636 results in additional FTP login attempts from that same host to receive
637 the following FTP response:
638 <pre>
639 530 Sorry, you may not connect more than one time.
640 </pre>
641
642 <p>
643 <hr>
644 <h3><a name="MaxHostsPerUser">MaxHostsPerUser</a></h3>
645 <strong>Syntax:</strong> MaxHostsPerUser <em>count|"none" [message]</em><br>
646 <strong>Default:</strong> None<br>
647 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
648 <strong>Module:</strong> mod_auth<br>
649 <strong>Compatibility:</strong> 1.2.4 and later
650
651 <p>
652 The <code>MaxHostsPerUser</code> directive configures the maximum number of
653 times different hosts, using a given login, can connect at any given time.
654 The optional <em>message</em> parameter may be used, which will be displayed to
655 a client attempting to exceed the maximum value. If <em>message</em> is
656 <i>not</i> supplied, the following message is used by default:
657 <pre>
658 "Sorry, the maximum number of hosts (%m) for this user already connected."
659 </pre>
660
661 <p>
662 For example:
663 <pre>
664 MaxHostsPerUser 1 "Sorry, you may not connect more than one time."
665 </pre>
666 Will result in the following FTP response, when the <em>count</em> limit is
667 exceeded:
668 <pre>
669 "530 Sorry, you may not connect more than one time."
670 </pre>
671
672 <p>
673 See also: <a href="#MaxClients"><code>MaxClients</code></a>, <a href="#MaxClientsPerHost"><code>MaxClientsPerHost</code></a>
674
675 <p>
676 <hr>
677 <h3><a name="MaxLoginAttempts">MaxLoginAttempts</a></h3>
678 <strong>Syntax:</strong> MaxLoginAttempts <em>count</em><br>
679 <strong>Default:</strong> 3<br>
680 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
681 <strong>Module:</strong> mod_auth<br>
682 <strong>Compatibility:</strong> 0.99.0 and later
683
684 <p>
685 The <code>MaxLoginAttempts</code> directive configures the maximum number of
686 times a client may attempt to authenticate to the server <i>on the same TCP
687 connection</i>. After the number of attempts exceeds the configured
688 <em>count</em>, the client is disconnected and an appropriate message is
689 logged.
690
691 <p>
692 <hr>
693 <h3><a name="MaxPasswordSize">MaxPasswordSize</a></h3>
694 <strong>Syntax:</strong> MaxPasswordSize <em>length</em><br>
695 <strong>Default:</strong> 1024<br>
696 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
697 <strong>Module:</strong> mod_auth<br>
698 <strong>Compatibility:</strong> 1.3.6rc3 and later
699
700 <p>
701 The <code>MaxPasswordSize</code> directive configures the maximum length
702 (in bytes) of a password that ProFTPD will accept. Passwords longer than
703 the configured <em>length</em> will be ignored.
704
705 <p>
706 This directive is provided as a defensive measure, to protect against CPU
707 resource consumption attacks by feeding large amounts of data to <i>e.g.</i>
708 the <code>crypt(3)</code> function.
709
710 <p>
711 <hr>
712 <h3><a name="RequireValidShell">RequireValidShell</a></h3>
713 <strong>Syntax:</strong> RequireValidShell <em>on|off</em><br>
714 <strong>Default:</strong> RequireValidShell on<br>
715 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
716 <strong>Module:</strong> mod_auth<br>
717 <strong>Compatibility:</strong> 0.99.0 and later
718
719 <p>
720 The <code>RequireValidShell</code> directive configures the server, virtual
721 host or anonymous login to allow or deny logins which do not have a shell
722 listed in <code>/etc/shells</code>. By default, <code>proftpd</code>
723 <b>will not allow a login</b> unless the user's default shell is listed in
724 <code>/etc/shells</code>. If <code>/etc/shells</code> cannot be found, all
725 default shells are assumed to be valid.
726
727 <p>
728 <hr>
729 <h3><a name="RewriteHome">RewriteHome</a></h3>
730 <strong>Syntax:</strong> RewriteHome <em>on|off</em><br>
731 <strong>Default:</strong> None<br>
732 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
733 <strong>Module:</strong> mod_auth<br>
734 <strong>Compatibility:</strong> 1.3.3rc1 and later
735
736 <p>
737 The <code>RewriteHome</code> directive can be used to support rewriting the
738 home directory for a user, based on regular expression rules. One such use
739 case is where some portion of the home directory is retrieved <i>e.g.</i>
740 from an LDAP directory, but you need to apply some custom prefix to the LDAP
741 attribute. <b>Note</b> that this feature requires that the
742 <code>mod_rewrite</code> module also be present in your <code>proftpd</code>
743 daemon.
744
745 <p>
746 To enable this feature, first you need to add the following to your
747 <code>proftpd.conf</code>:
748 <pre>
749 RewriteHome on
750 </pre>
751 Next, you need to configure the mod_rewrite rules for rewriting your home
752 directory; this feature depends on the <code>mod_rewrite</code> module for the
753 rewriting. The pseudo-command used by <code>mod_rewrite</code> for rewriting
754 home directories is "REWRITE_HOME". Thus would you use:
755 <pre>
756 &lt;IfModule mod_rewrite.c&gt;
757 RewriteEngine on
758 RewriteLog /path/to/rewrite.log
759
760 RewriteCondition %m REWRITE_HOME
761 RewriteRule (.*) /my/new/prefix$1
762 &lt;/IfModule&gt;
763 </pre>
764
765 <p>
766 <hr>
767 <h3><a name="RootLogin">RootLogin</a></h3>
768 <strong>Syntax:</strong> RootLogin <em>on|off</em><br>
769 <strong>Default:</strong> RootLogin off<br>
770 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
771 <strong>Module:</strong> mod_auth<br>
772 <strong>Compatibility:</strong> 1.1.5 and later
773
774 <p>
775 Normally, <code>proftpd</code> does <b>not allow</b> root logins under any
776 circumstance. If a client attempts to login as root, using the correct
777 password, a special security message is logged:
778 <pre>
779 SECURITY VIOLATION: Root login attempted
780 </pre>
781
782 When <code>RootLogin on</code> is used, the root user may authenticate just as
783 any other user could (assuming no <i>other</i> access control measures deny
784 access); however the root login security message is still logged:
785 <pre>
786 ROOT FTP login successful.
787 </pre>
788 Obviously, extreme care should be taken when using this directive.
789
790 <p>
791 The use of <code>RootLogin</code> in the <code>&lt;Anonymous&gt;</code>
792 context is only valid when the <code>User</code>/<code>Group</code> defined
793 in the <code>&lt;Anonymous&gt;</code> section is set to 'root'.
794
795 <p>
796 <hr>
797 <h3><a name="RootRevoke">RootRevoke</a></h3>
798 <strong>Syntax:</strong> RootRevoke <em>on|off|UseNonCompliantActiveTransfers</em><br>
799 <strong>Default:</strong> None<br>
800 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
801 <strong>Module:</strong> mod_auth<br>
802 <strong>Compatibility:</strong> 1.2.9rc1 and later
803
804 <p>
805 The <code>RootRevoke</code> directive causes all root privileges to be dropped
806 once a user is authenticated. This will also cause active data transfers
807 (<i>e.g.</i> via the <code>PORT</code>/<code>EPRT</code> FTP commands) to be
808 disabled <i>if the server is listening on a port less than 1024</i>. Note that
809 this only affects <i>active</i> data transfers; passive transfers will not be
810 blocked.
811
812 <p>
813 The reason for rejecting active data transfers in these cases is because of
814 a requirement in RFC 959 (which defines the File Transfer Protocol) that for
815 active data transfers, the data connection <b>must</b> have a source port of
816 <em>L</em>-1, where <em>L</em> is the control connection port (see RFC 959, Section 3.2 "Establishing Data Connections"). Thus if the FTP server listens on
817 port 21, then a client requesting an active data transfer from that server
818 will have a data connection whose source port (on the server) is port 20
819 (<em>L</em> = 21, <em>L</em>-1 = 20).
820
821 <p>
822 Even though passive data transfers are highly preferable, many FTP clients
823 may still require/expect to be able to do an active data transfer. One
824 question, though, is how many FTP clients actually <i>check</i> that the
825 source port of the active data transfer connection is actually <em>L</em>-1.
826 Or how many networking appliances along the way (<i>i.e.</i> firewalls, NATs,
827 routers, <i>etc</i>) enforce this restriction as well.
828
829 <p>
830 If not for that requirement, then with "RootRevoke on" in the
831 <code>proftpd.conf</code>, <code>proftpd</code> would not be <i>required</i>
832 to use root privileges for binding to a privileged port like port 20.
833
834 <p>
835 Thus the <code>RootRevoke</code> directive also accepts (as of ProFTPD 1.3.5rc1)
836 a parameter of "UseNonCompliantActiveTransfers", <i>e.g.</i>:
837 <pre>
838 # Drop root privs, but allow active data transfers (only use a non-standard
839 # source port for the active data connection).
840 RootRevoke UseNonCompliantActiveTranfers
841 </pre>
842 With this configuration, <code>proftpd</code> will drop root privileges,
843 <i>but</i> would <b>not</b> reject <code>PORT</code>/<code>EPRT</code>
844 commands at all. Instead, the active data transfers would be allowed as per
845 normal, except that <code>proftpd</code> would not try to bind to the
846 <em>L</em>-1 port for those active transfers.
847
848 <p>
849 This <code>RootRevoke</code> parameter is valuable because it helps in
850 getting <code>proftpd</code> to drop root privileges for sessions more often,
851 which is a <b>far more secure configuration</b>. Exploits such as the
852 "Roaring Beast" attack would not be possible in a session where root privileges
853 have been dropped completely.
854
855 <p>
856 <b>Note</b>: In ProFTPD 1.3.7rc1 and later, the default value for
857 <code>RootRevoke</code> became <em>on</em>, meaning that root privileges are
858 dropped by default, unless explicitly configured via this directive. The
859 default behavior is that of the <code>UseNonCompliantActiveTransfers</code>
860 parameter, so that <code>PORT</code> and <code>EPRT</code> commands are not
861 rejected.
862
863 <p>
864 <hr>
865 <h3><a name="TimeoutLogin">TimeoutLogin</a></h3>
866 <strong>Syntax:</strong> TimeoutLogin <em>seconds</em><br>
867 <strong>Default:</strong> 300 seconds<br>
868 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
869 <strong>Module:</strong> mod_auth<br>
870 <strong>Compatibility:</strong> 0.99.0 and later
871
872 <p>
873 The <code>TimeoutLogin</code> directive configures the maximum number of
874 <em>seconds</em> a client is allowed to spend authenticating, <i>i.e.</i>
875 from the time when the client connects to the time when the client has
876 successfully authenticated. The login timer is <b>not</b> reset when a client
877 transmits data, and is only removed once a client has transmitted an
878 acceptable combination of <code>USER</code>/<code>PASS</code> commands.
879 The maximum allowed <em>seconds</em> value is 65535 (18 hours).
880
881 <p>
882 See also: <a href="mod_core.html#TimeoutIdle"><code>TimeoutIdle</code></a>,
883 <a href="mod_xfer.html#TimeoutNoTransfer"><code>TimeoutNoTransfer</code></a>,
884 <a href="mod_xfer.html#TimeoutStalled"><code>TimeoutStalled</code></a>
885
886 <p>
887 <hr>
888 <h3><a name="TimeoutSession">TimeoutSession</a></h3>
889 <strong>Syntax:</strong> TimeoutSessions <em>seconds</em><br>
890 <strong>Default:</strong> None<br>
891 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
892 <strong>Module:</strong> mod_auth<br>
893 <strong>Compatibility:</strong> 1.2.6rc1 and later
894
895 <p>
896 The <code>TimeoutSession</code> directive sets the maximum number of
897 <em>seconds</em> a control connection between the proftpd server and client
898 can exist, after the client has successfully authenticated. If the
899 <em>seconds</em> argument is set to zero, sessions are allowed to last
900 indefinitely; this is the default. There is no maximum value for the
901 <em>seconds</em> parameter.
902
903 <p>
904 <hr>
905 <h3><a name="UseFtpUsers">UseFtpUsers</a></h3>
906 <strong>Syntax:</strong> UseFtpUsers <em>on|off</em><br>
907 <strong>Default:</strong> UseFtpUsers on<br>
908 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
909 <strong>Module:</strong> mod_auth<br>
910 <strong>Compatibility:</strong> 0.99.0 and later
911
912 <p>
913 Legacy FTP servers generally check a special authorization file (typically
914 <code>/etc/ftpusers</code>) when a client attempts to authenticate.
915 <b>If</b> the user's name is <i>found</i> in this file, FTP access is
916 <i>denied</i>. For compatibility of behavior, <code>proftpd</code> defaults to
917 checking this same file during authentication. This behavior can be suppressed
918 using the <code>UseFtpUsers</code> directive, <i>e.g.</i>:
919 <pre>
920 # Do not check /etc/ftpusers
921 UseFtpUsers off
922 </pre>
923
924 <p>
925 <hr>
926 <h3><a name="UseLastlog">UseLastlog</a></h3>
927 <strong>Syntax:</strong> UseLastlog <em>on|off</em><br>
928 <strong>Default:</strong> UseLastlog off<br>
929 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
930 <strong>Module:</strong> mod_auth<br>
931 <strong>Compatibility:</strong> 1.3.1 and later
932
933 <p>
934 The <code>UseLastlog</code> directive configures whether ProFTPD will update
935 the <a href="https://en.wikipedia.org/wiki/Lastlog"><code>/var/log/lastlog</code></a> file for FTP logins.
936
937 <p>
938 Example:
939 <pre>
940 # Enable recording FTP logins in /var/log/lastlog
941 UseLastlog on
942 </pre>
943
944 <p>
945 <hr>
946 <h3><a name="UserAlias">UserAlias</a></h3>
947 <strong>Syntax:</strong> UserAlias <em>alias real-user</em><br>
948 <strong>Default:</strong> None<br>
949 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
950 <strong>Module:</strong> mod_auth<br>
951 <strong>Compatibility:</strong> 0.99.0 and later
952
953 <p>
954 ProFTPD requires a real username (<i>i.e.</i> known via
955 <code>/etc/passwd</code>, <code>AuthUserFile</code>, LDAP, SQL, RADIUS,
956 <i>etc</i>) when authenticating a client. There <i>are</i>, however, times
957 when an additional <em>alias</em> is required <i>but</i> is undesirable to
958 provide an additional login accounts.
959
960 <p>
961 The <code>UserAlias</code> directive provides a mechanism to do just this.
962 A typical and common example of <code>UserAlias</code> is for
963 <code>&lt;Anonymous&gt;</code> configuration sections. It is conventional for
964 the server to use user "ftp" as the primary authentication user; it is common
965 practice to allow users to login using the name "anonymous". This is achieved
966 by using the following in the config file:
967 <pre>
968 &lt;Anonymous ~ftp&gt;
969 ...
970 UserAlias anonymous ftp
971 ...
972 &lt;/Anonymous&gt;
973 </pre>
974
975 <p>
976 <hr>
977 <h3><a name="UserPassword">UserPassword</a></h3>
978 <strong>Syntax:</strong> UserPassword <em>user encrypted-password</em><br>
979 <strong>Default:</strong> None<br>
980 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
981 <strong>Module:</strong> mod_auth<br>
982 <strong>Compatibility:</strong> 0.99.0pl5 and later
983
984 <p>
985 The <code>UserPassword</code> directive creates a password for a particular
986 <em>user</em>; this configured password will <i>override</i> the user's normal
987 password in <code>/etc/passwd</code> (or whichever auth module handles that
988 user). <b>Note</b> that the <em>user</em> configured is a real user, and
989 <b>not</b> a <code>UserAlias</code>.
990
991 <p>
992 The <em>encrypted-password</em> parameter is a string which has been passed
993 through the standard Unix <code>crypt(3)</code> function. <b>Do not use a
994 cleartext password</b>. To obtain this <em>encrypted-password</em> value,
995 you can use the <a href="../utils/ftpasswd.html"><code>ftpasswd</code></a>
996 script's <code>--hash</code> option, <i>e.g.</i>:
997 <pre>
998 $ ftpasswd --hash
999
1000 Password:
1001 Re-type password:
1002
1003 ftpasswd: $1$EsnXxyD6$tsO2YwTAT/Tl5u1NYPHIw1
1004 </pre>
1005
1006 <p>
1007 Example configuration:
1008 <pre>
1009 # Override user bob's password with a hash version of "password"
1010 UserPassword bob $1$EsnXxyD6$tsO2YwTAT/Tl5u1NYPHIw1
1011 </pre>
1012
1013 <p>
1014 <hr>
1015 <h3><a name="WtmpLog">WtmpLog</a></h3>
1016 <strong>Syntax:</strong> WtmpLog <em>on|off</em><br>
1017 <strong>Default:</strong> WtmpLog on<br>
1018 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
1019 <strong>Module:</strong> mod_auth<br>
1020 <strong>Compatibility:</strong> 1.1.7 and later
1021
1022 <p>
1023 The <code>WtmpLog</code> directive controls the logging of connections to the
1024 host system <a href="https://en.wikipedia.org/wiki/Utmp"><code>wtmp</code></a>
1025 file, which used by such commands as <code>last</code>. By default, <b>all</b>
1026 connections are logged via <code>wtmp</code>.
1027
1028 <p>
1029 <hr>
1030 <h2><a name="Installation">Installation</a></h2>
1031 The <code>mod_auth</code> module is compiled by default.
1032
1033 <p>
1034 <hr>
1035 <font size=2><b><i>
1036 &copy; Copyright 2002-2021<br>
1037 All Rights Reserved<br>
1038 </i></b></font>
1039 <hr>
1040
1041 </body>
1042 </html>