mod_auth.html revision adf3bb65172d14e7dae217ddadf2b4cd405b21be
2N/A<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2N/A<HTML>
2N/A<HEAD>
2N/A<TITLE>Apache module mod_auth</TITLE>
2N/A</HEAD>
2N/A
2N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
2N/A<BODY
2N/A BGCOLOR="#FFFFFF"
2N/A TEXT="#000000"
2N/A LINK="#0000FF"
2N/A VLINK="#000080"
2N/A ALINK="#FF0000"
2N/A>
2N/A<!--#include virtual="header.html" -->
2N/A
2N/A<H1 ALIGN="CENTER">Module mod_auth</H1>
2N/A
2N/A<P>This module provides for user authentication using text files.
2N/A
2N/A<P><A
2N/AHREF="module-dict.html#Status"
2N/AREL="Help"
2N/A><STRONG>Status:</STRONG></A> Base
2N/A<BR>
2N/A<A
2N/AHREF="module-dict.html#SourceFile"
2N/AREL="Help"
2N/A><STRONG>Source File:</STRONG></A> mod_auth.c
2N/A<BR>
2N/A<A
2N/AHREF="module-dict.html#ModuleIdentifier"
2N/AREL="Help"
2N/A><STRONG>Module Identifier:</STRONG></A> auth_module
2N/A</P>
2N/A
2N/A<H2>Summary</H2>
2N/A
2N/A<P>This module allows the use of HTTP Basic Authentication to restrict
2N/Aaccess by looking up users in plain text password and group files.
2N/ASimilar functionality and greater scalability is provided by <A
2N/AHREF="mod_auth_dbm.html">mod_auth_dbm</A> and <A
2N/AHREF="mod_auth_db.html">mod_auth_db</A>. HTTP Digest Authentication
2N/Ais provided by <A HREF="mod_auth_digest.html">mod_auth_digest</A>.
2N/A
2N/A
2N/A<H2>Directives</H2>
2N/A
2N/A<UL>
2N/A<LI><A HREF="#authgroupfile">AuthGroupFile</A>
2N/A<LI><A HREF="#authuserfile">AuthUserFile</A>
2N/A<LI><A HREF="#authauthoritative">AuthAuthoritative</A>
2N/A</UL>
2N/A
2N/A<P>See also: <A HREF="core.html#require">require</A>
2N/Aand <A HREF="core.html#satisfy">satisfy</A>.</P>
2N/A
2N/A<HR>
2N/A
2N/A
2N/A<H2><A NAME="authgroupfile">AuthGroupFile</A> directive</H2>
2N/A<!--%plaintext &lt;?INDEX {\tt AuthGroupFile} directive&gt; -->
2N/A<A
2N/A HREF="directive-dict.html#Syntax"
2N/A REL="Help"
2N/A><STRONG>Syntax:</STRONG></A> AuthGroupFile <EM>filename</EM><BR>
2N/A<A
2N/A HREF="directive-dict.html#Context"
2N/A REL="Help"
2N/A><STRONG>Context:</STRONG></A> directory, .htaccess<BR>
2N/A<A
2N/A HREF="directive-dict.html#Override"
2N/A REL="Help"
2N/A><STRONG>Override:</STRONG></A> AuthConfig<BR>
2N/A<A
2N/A HREF="directive-dict.html#Status"
2N/A REL="Help"
2N/A><STRONG>Status:</STRONG></A> Base<BR>
2N/A<A
2N/A HREF="directive-dict.html#Module"
2N/A REL="Help"
2N/A><STRONG>Module:</STRONG></A> mod_auth<P>
2N/A
2N/AThe AuthGroupFile directive sets the name of a textual file containing the list
2N/Aof user groups for user authentication. <EM>Filename</EM> is the path
2N/Ato the group file. If it is not absolute (<EM>i.e.</EM>, if it
2N/Adoesn't begin with a slash), it is treated as relative to the ServerRoot.
2N/A<P>
2N/AEach line of the group file contains a groupname followed by a colon, followed
2N/Aby the member usernames separated by spaces. Example:
2N/A<BLOCKQUOTE><CODE>mygroup: bob joe anne</CODE></BLOCKQUOTE>
2N/ANote that searching large text files is <EM>very</EM> inefficient;
2N/A<A HREF="mod_auth_dbm.html#authdbmgroupfile">AuthDBMGroupFile</A> should
2N/Abe used instead.<P>
2N/A
2N/ASecurity: make sure that the AuthGroupFile is stored outside the
2N/Adocument tree of the web-server; do <EM>not</EM> put it in the directory that
2N/Ait protects. Otherwise, clients will be able to download the AuthGroupFile.<P>
2N/A
2N/ASee also <A HREF="core.html#authname">AuthName</A>,
2N/A<A HREF="core.html#authtype">AuthType</A> and
2N/A<A HREF="#authuserfile">AuthUserFile</A>.<P><HR>
2N/A
2N/A<H2><A NAME="authuserfile">AuthUserFile</A> directive</H2>
2N/A<!--%plaintext &lt;?INDEX {\tt AuthUserFile} directive&gt; -->
2N/A<A
2N/A HREF="directive-dict.html#Syntax"
2N/A REL="Help"
2N/A><STRONG>Syntax:</STRONG></A> AuthUserFile <EM>filename</EM><BR>
2N/A<A
2N/A HREF="directive-dict.html#Context"
2N/A REL="Help"
2N/A><STRONG>Context:</STRONG></A> directory, .htaccess<BR>
2N/A<A
2N/A HREF="directive-dict.html#Override"
2N/A REL="Help"
2N/A><STRONG>Override:</STRONG></A> AuthConfig<BR>
2N/A<A
2N/A HREF="directive-dict.html#Status"
2N/A REL="Help"
2N/A><STRONG>Status:</STRONG></A> Base<BR>
2N/A<A
2N/A HREF="directive-dict.html#Module"
2N/A REL="Help"
2N/A><STRONG>Module:</STRONG></A> mod_auth<P>
2N/A
2N/AThe AuthUserFile directive sets the name of a textual file containing
2N/Athe list of users and passwords for user
2N/Aauthentication. <EM>Filename</EM> is the path to the user
2N/Afile. If it is not absolute (<EM>i.e.</EM>, if it doesn't begin with a
2N/Aslash), it is treated as relative to the ServerRoot.
2N/A<P> Each line of the user file file contains a username followed
2N/Aby a colon, followed by the crypt() encrypted password. The behavior
2N/Aof multiple occurrences of the same user is undefined.
2N/A<P>
2N/AThe utility <code>htpasswd</code> which is installed as part of the
2N/Abinary distribution, or which can be found in <code>src/support</code>,
2N/Ais used to maintain this password file. See the <code>man</code>
2N/Apage for more details. In short
2N/A<p>
2N/A<blockquote>
2N/A <code>htpasswd -c Filename username</code><br>
2N/A Create a password file 'Filename' with 'username'
2N/A as the initial ID. It will prompt for the password.
2N/A <code>htpasswd Filename username2</code><br>
Adds or modifies in password file 'Filename' the 'username'.
</blockquote>
<P> Note that
searching large text files is <EM>very</EM> inefficient;
<A HREF="mod_auth_dbm.html#authdbmuserfile">AuthDBMUserFile</A> should be
used instead.
<P>
Security: make sure that the AuthUserFile is stored outside the
document tree of the web-server; do <EM>not</EM> put it in the directory that
it protects. Otherwise, clients will be able to download the AuthUserFile.<P>
See also <A HREF="core.html#authname">AuthName</A>,
<A HREF="core.html#authtype">AuthType</A> and
<A HREF="#authgroupfile">AuthGroupFile</A>.<P>
<HR>
<H2><A NAME="authauthoritative">AuthAuthoritative</A> directive</H2>
<!--%plaintext &lt;?INDEX {\tt AuthAuthoritative} directive&gt; -->
<A
HREF="directive-dict.html#Syntax"
REL="Help"
><STRONG>Syntax:</STRONG></A> AuthAuthoritative &lt;
<STRONG> on</STRONG>(default) | off &gt; <BR>
<A
HREF="directive-dict.html#Context"
REL="Help"
><STRONG>Context:</STRONG></A> directory, .htaccess<BR>
<A
HREF="directive-dict.html#Override"
REL="Help"
><STRONG>Override:</STRONG></A> AuthConfig<BR>
<A
HREF="directive-dict.html#Status"
REL="Help"
><STRONG>Status:</STRONG></A> Base<BR>
<A
HREF="directive-dict.html#Module"
REL="Help"
><STRONG>Module:</STRONG></A> mod_auth<P>
Setting the AuthAuthoritative directive explicitly to <STRONG>'off'</STRONG>
allows for both authentication and authorization to be passed on to
lower level modules (as defined in the <CODE>Configuration</CODE> and
<CODE>modules.c</CODE> files) if there is <STRONG>no userID</STRONG> or
<STRONG>rule</STRONG> matching the supplied userID. If there is a userID and/or
rule specified; the usual password and access checks will be applied
and a failure will give an Authorization Required reply.
<P>
So if a userID appears in the database of more than one module; or if
a valid <CODE>Require</CODE> directive applies to more than one module; then the
first module will verify the credentials; and no access is passed on;
regardless of the AuthAuthoritative setting.
<P>
A common use for this is in conjunction with one of the database
modules; such as <A
HREF="mod_auth_db.html"><CODE>mod_auth_db.c</CODE></A>, <A
HREF="mod_auth_dbm.html"><CODE>mod_auth_dbm.c</CODE></A>,
<CODE>mod_auth_msql.c</CODE>, and <A
HREF="mod_auth_anon.html"><CODE>mod_auth_anon.c</CODE></A>. These modules
supply the bulk of the user credential checking; but a few
(administrator) related accesses fall through to a lower level with a
well protected AuthUserFile.
<P>
<A
HREF="directive-dict.html#Default"
REL="Help"
><STRONG>Default:</STRONG></A> By default; control is not passed on; and an
unknown
userID or rule will result in an Authorization Required reply. Not
setting it thus keeps the system secure; and forces an NCSA compliant
behaviour.
<P>
Security: Do consider the implications of allowing a user to allow
fall-through in his .htaccess file; and verify that this is really
what you want; Generally it is easier to just secure a single
.htpasswd file, than it is to secure a database such as mSQL. Make
sure that the AuthUserFile is stored outside the document tree of the
web-server; do <EM>not</EM> put it in the directory that it
protects. Otherwise, clients will be able to download the
AuthUserFile.
<P>
See also <A HREF="core.html#authname">AuthName</A>,
<A HREF="core.html#authtype">AuthType</A> and
<A HREF="#authgroupfile">AuthGroupFile</A>.<P>
<!--#include virtual="footer.html" -->
</BODY>
</HTML>