mod_auth.html revision 240a5b8962329911d02566b600be6226e1f857ae
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync This file is generated from xml source: DO NOT EDIT
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync--><title>mod_auth - Apache HTTP Server</title><link rel="stylesheet" type="text/css" href="/style/manual.css"/></head><body><blockquote><div align="center"><img src="/images/sub.gif" alt="[APACHE DOCUMENTATION]"/><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Apache Module mod_auth</h1><table bgcolor="#cccccc" cellpadding="0" cellspacing="1"><tr><td><table bgcolor="#ffffff"><tr><td valign="top"><span class="help">Description:</span></td><td>User authentication using text files</td></tr><tr><td><a class="help" href="module-dict.html#Status">Status:</a></td><td>Base</td></tr><tr><td><a class="help" href="module-dict.html#ModuleIdentifier">Module Identifier:</a></td><td>auth_module</td></tr></table></td></tr></table><h2>Summary</h2>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>This module allows the use of HTTP Basic Authentication to
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync restrict access by looking up users in plain text password and
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync group files. Similar functionality and greater scalability is
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync provided by <code><a href="mod_auth_dbm.html">mod_auth_dbm</a></code>. HTTP Digest
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync Authentication is provided by
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <code><a href="mod_auth_digest.html">mod_auth_digest</a></code>.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<h2>Directives</h2><ul><li><a href="#authauthoritative">AuthAuthoritative</a></li><li><a href="#authgroupfile">AuthGroupFile</a></li><li><a href="#authuserfile">AuthUserFile</a></li></ul><p><strong>See also </strong></p><ul><li><a class="directive" href="core.html#require"><code class="directive">Require</code></a></li><li><a class="directive" href="core.html#satisfy"><code class="directive">Satisfy</code></a></li><li><a class="directive" href="core.html#authname"><code class="directive">AuthName</code></a></li><li><a class="directive" href="core.html#authtype"><code class="directive">AuthType</code></a></li></ul><hr/><h2><a name="AuthAuthoritative">AuthAuthoritative</a> <a name="authauthoritative">Directive</a></h2><table bgcolor="#cccccc" border="0" cellspacing="0" cellpadding="1"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets whether authorization and authentication are
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncpassed to lower level modules</td></tr><tr><td><a class="help" href="directive-dict.html#Syntax">Syntax:</a></td><td>AuthAuthoritative on|off</td></tr><tr><td><a class="help" href="directive-dict.html#Default">Default:</a></td><td><code>AuthAuthoritative on</code></td></tr><tr><td><a class="help" href="directive-dict.html#Context">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a class="help" href="directive-dict.html#Override">Override:</a></td><td>AuthConfig</td></tr><tr><td><a class="help" href="directive-dict.html#Status">Status:</a></td><td>Base</td></tr><tr><td><a class="help" href="directive-dict.html#Module">Module:</a></td><td>mod_auth</td></tr></table></td></tr></table>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<blockquote><table><tr><td bgcolor="#e0e5f5">This information has not been updated for Apache 2.0, which
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncuses a different system for module ordering.</td></tr></table></blockquote>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>Setting the <code class="directive">AuthAuthoritative</code> directive
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync explicitly to <strong>'off'</strong> allows for both
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync authentication and authorization to be passed on to lower level
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync modules (as defined in the <code>Configuration</code> and
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <code>modules.c</code> files) if there is <strong>no
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync userID</strong> or <strong>rule</strong> matching the supplied
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync userID. If there is a userID and/or rule specified; the usual
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync password and access checks will be applied and a failure will give
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync an Authorization Required reply.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>So if a userID appears in the database of more than one module;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync or if a valid <a class="directive" href="core.html#require"><code class="directive">Require</code></a>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync directive applies to more than one module; then the first module
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync will verify the credentials; and no access is passed on;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync regardless of the AuthAuthoritative setting.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>A common use for this is in conjunction with one of the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync database modules; such as <code><a href="auth_dbm.html">auth_dbm</a></code>,
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <code>mod_auth_msql</code>, and <code><a href="mod_auth_anon.html">mod_auth_anon</a></code>.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync These modules supply the bulk of the user credential checking; but
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync a few (administrator) related accesses fall through to a lower
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync level with a well protected <a class="directive" href="#authuserfile"><code class="directive">AuthUserFile</code></a>.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>By default; control is not passed on; and an unknown userID or
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync rule will result in an Authorization Required reply. Not setting
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync it thus keeps the system secure; and forces an NCSA compliant
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync behaviour.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <blockquote><table><tr><td bgcolor="#e0e5f5"><p align="center"><strong>Security</strong></p> Do consider the implications of
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync allowing a user to allow fall-through in his .htaccess file; and
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync verify that this is really what you want; Generally it is easier
d02610fd604cc8ab4cccf7e3fa510c06cb728ff2vboxsync to just secure a single .htpasswd file, than it is to secure a
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync database such as mSQL. Make sure that the <a class="directive" href="#authuserfile"><code class="directive">AuthUserFile</code></a> is stored outside the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync document tree of the web-server; do <em>not</em> put it in the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync directory that it protects. Otherwise, clients will be able to
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync download the <a class="directive" href="#authuserfile"><code class="directive">AuthUserFile</code></a>.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<hr/><h2><a name="AuthGroupFile">AuthGroupFile</a> <a name="authgroupfile">Directive</a></h2><table bgcolor="#cccccc" border="0" cellspacing="0" cellpadding="1"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets the name of a text file containing the list
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncof user groups for authentication</td></tr><tr><td><a class="help" href="directive-dict.html#Syntax">Syntax:</a></td><td>AuthGroupFile <em>file-path</em></td></tr><tr><td><a class="help" href="directive-dict.html#Context">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a class="help" href="directive-dict.html#Override">Override:</a></td><td>AuthConfig</td></tr><tr><td><a class="help" href="directive-dict.html#Status">Status:</a></td><td>Base</td></tr><tr><td><a class="help" href="directive-dict.html#Module">Module:</a></td><td>mod_auth</td></tr></table></td></tr></table>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>The <code class="directive">AuthGroupFile</code> directive sets the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync name of a textual file containing the list of user groups for user
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync authentication. <em>File-path</em> is the path to the group
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync file. If it is not absolute (<em>i.e.</em>, if it doesn't begin
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync with a slash), it is treated as relative to the <a class="directive" href="core.html#serverroot"><code class="directive">ServerRoot</code></a>.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>Each line of the group file contains a groupname followed by a
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync colon, followed by the member usernames separated by spaces.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync Example:</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>mygroup: bob joe anne</code></td></tr></table></blockquote>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>Note that searching large text files is <em>very</em>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync inefficient; <a class="directive" href="mod_auth_dbm.html#authdbmgroupfile"><code class="directive">AuthDBMGroupFile</code></a> should be used
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync instead.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<blockquote><table><tr><td bgcolor="#e0e5f5"><p align="center"><strong>Security</strong></p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>Make sure that the AuthGroupFile is stored outside
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync the document tree of the web-server; do <em>not</em> put it in
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync the directory that it protects. Otherwise, clients will be able
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync to download the AuthGroupFile.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<hr/><h2><a name="AuthUserFile">AuthUserFile</a> <a name="authuserfile">Directive</a></h2><table bgcolor="#cccccc" border="0" cellspacing="0" cellpadding="1"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets the name of a text file containing the list of users and
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncpasswords for authentication</td></tr><tr><td><a class="help" href="directive-dict.html#Syntax">Syntax:</a></td><td>AuthUserFile <em>file-path</em></td></tr><tr><td><a class="help" href="directive-dict.html#Context">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a class="help" href="directive-dict.html#Override">Override:</a></td><td>AuthConfig</td></tr><tr><td><a class="help" href="directive-dict.html#Status">Status:</a></td><td>Base</td></tr><tr><td><a class="help" href="directive-dict.html#Module">Module:</a></td><td>mod_auth</td></tr></table></td></tr></table>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>The <code class="directive">AuthUserFile</code> directive sets the name
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync of a textual file containing the list of users and passwords for
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync user authentication. <em>File-path</em> is the path to the user
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync file. If it is not absolute (<em>i.e.</em>, if it doesn't begin
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync with a slash), it is treated as relative to the <a class="directive" href="core.html#serverroot"><code class="directive">ServerRoot</code></a>.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>Each line of the user file file contains a username followed by
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync a colon, followed by the <code>crypt()</code> encrypted
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync password. The behavior of multiple occurrences of the same user is
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync undefined.</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>The utility <a href="/programs/htpasswd.html">htpasswd</a>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync which is installed as part of the binary distribution, or which
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync can be found in <code>src/support</code>, is used to maintain
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync this password file. See the <code>man</code> page for more
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync details. In short:</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>Create a password file 'Filename' with 'username' as the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync initial ID. It will prompt for the password:</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>htpasswd -c Filename username</code></td></tr></table></blockquote>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<p>Adds or modifies in password file 'Filename' the 'username':</p>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>htpasswd Filename username2</code></td></tr></table></blockquote>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync <p>Note that searching large text files is <em>very</em>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync inefficient; <a class="directive" href="mod_auth_dbm.html#authdbmuserfile"><code class="directive">AuthDBMUserFile</code></a> should be used
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync instead.</p>
7c205843b5f25329b7bac4cb41e4c55a21c7aafevboxsync<blockquote><table><tr><td bgcolor="#e0e5f5"><p align="center"><strong>Security</strong></p><p>Make sure that the AuthUserFile is
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncstored outside the document tree of the web-server; do <em>not</em>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncput it in the directory that it protects. Otherwise, clients will be
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncable to download the AuthUserFile.</p></td></tr></table></blockquote>