2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="mod_authn_file.xml.meta">
25 <name>mod_authn_file</name>
26 <description>User authentication using text files</description>
28 <sourcefile>mod_authn_file.c</sourcefile>
29 <identifier>authn_file_module</identifier>
32 <p>This module provides authentication front-ends such as
33 <module>mod_auth_digest</module> and <module>mod_auth_basic</module>
34 to authenticate users by looking up users in plain text password files.
35 Similar functionality is provided by <module>mod_authn_dbm</module>.</p>
37 <p>When using <module>mod_auth_basic</module> or
38 <module>mod_auth_digest</module>, this module is invoked via the
39 <directive module="mod_auth_basic">AuthBasicProvider</directive> or
40 <directive module="mod_auth_digest">AuthDigestProvider</directive>
41 with the <code>file</code> value.</p>
44 <directive module="mod_auth_basic">AuthBasicProvider</directive>
47 <directive module="mod_auth_digest">AuthDigestProvider</directive>
49 <seealso><program>htpasswd</program></seealso>
50 <seealso><program>htdigest</program></seealso>
51 <seealso><a href="../misc/password_encryptions.html">Password Formats</a></seealso>
54 <name>AuthUserFile</name>
55 <description>Sets the name of a text file containing the list of users and
56 passwords for authentication</description>
57 <syntax>AuthUserFile <var>file-path</var></syntax>
58 <contextlist><context>directory</context><context>.htaccess</context>
60 <override>AuthConfig</override>
63 <p>The <directive>AuthUserFile</directive> directive sets the name
64 of a textual file containing the list of users and passwords for
65 user authentication. <var>File-path</var> is the path to the user
66 file. If it is not absolute, it is treated as relative to the
67 <directive module="core">ServerRoot</directive>.</p>
69 <p>Each line of the user file contains a username followed by
70 a colon, followed by the encrypted password. If the same user
71 ID is defined multiple times, <module>mod_authn_file</module> will
72 use the first occurrence to verify the password.</p>
74 <p>The encrypted password format depends on which authentication
75 frontend (e.g. <module>mod_auth_basic</module> or
76 <module>mod_auth_digest</module>) is being used. See <a
77 href="../misc/password_encryptions.html">Password Formats</a> for
80 <p>For <module>mod_auth_basic</module>, use the utility <program>htpasswd</program>
81 which is installed as part of the binary distribution, or which
82 can be found in <code>src/support</code>. See the
83 <a href="../programs/htpasswd.html">man page</a> for more details.
86 <p>Create a password file <code>Filename</code> with
87 <code>username</code> as the initial ID. It will prompt for
91 htpasswd -c Filename username
94 <p>Add or modify <code>username2</code> in the password file
95 <code>Filename</code>:</p>
98 htpasswd Filename username2
101 <p>Note that searching large text files is <em>very</em>
102 inefficient; <directive
103 module="mod_authn_dbm">AuthDBMUserFile</directive> should be used
106 <p>For <module>mod_auth_digest</module>, use <program>htdigest</program>
107 instead. Note that you cannot mix user data for Digest Authentication
108 and Basic Authentication within the same file.</p>
110 <note type="warning"><title>Security</title>
111 <p>Make sure that the <directive>AuthUserFile</directive> is
112 stored outside the document tree of the web-server. Do
113 <strong>not</strong> put it in the directory that it protects.
114 Otherwise, clients may be able to download the
115 <directive>AuthUserFile</directive>.</p>