2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Copyright 2003-2004 The Apache Software Foundation
9 Licensed under the Apache License, Version 2.0 (the "License");
10 you may not use this file except in compliance with the License.
11 You may obtain a copy of the License at
13 http://www.apache.org/licenses/LICENSE-2.0
15 Unless required by applicable law or agreed to in writing, software
16 distributed under the License is distributed on an "AS IS" BASIS,
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 See the License for the specific language governing permissions and
19 limitations under the License.
22 <modulesynopsis metafile="mod_authz_owner.xml.meta">
24 <name>mod_authz_owner</name>
25 <description>Authorization based on file ownership</description>
26 <status>Extension</status>
27 <sourcefile>mod_authz_owner.c</sourcefile>
28 <identifier>authz_owner_module</identifier>
29 <compatibility>Available in Apache 2.1 and later</compatibility>
32 <p>This module authorizes access to files by comparing the userid used
33 for HTTP authentication (the web userid) with the file-system owner or
34 group of the requested file. The supplied username and password
35 must be already properly verified by an authentication module,
36 such as <module>mod_auth_basic</module> or
37 <module>mod_auth_digest</module>. <module>mod_authz_owner</module>
38 recognizes two arguments for the <directive module="core"
39 >Require</directive> directive, <code>file-owner</code> and
40 <code>file-group</code>, as follows:</p>
43 <dt><code>file-owner</code></dt>
44 <dd>The supplied web-username must match the system's name for the
45 owner of the file being requested. That is, if the operating system
46 says the requested file is owned by <code>jones</code>, then the
47 username used to access it through the web must be <code>jones</code>
50 <dt><code>file-group</code></dt>
51 <dd>The name of the system group that owns the file must be present
52 in a group database, which is provided, for example, by <module
53 >mod_authz_groupfile</module> or <module>mod_authz_dbm</module>,
54 and the web-username must be a member of that group. For example, if
55 the operating system says the requested file is owned by (system)
56 group <code>accounts</code>, the group <code>accounts</code> must
57 appear in the group database and the web-username used in the request
58 must be a member of that group.</dd>
61 <note><title>Note</title>
62 <p>If <module>mod_authz_owner</module> is used in order to authorize
63 a resource that is not actually present in the filesystem
64 (<em>i.e.</em> a virtual resource), it will deny the access.</p>
66 <p>Particularly it will never authorize <a
67 href="../content-negotiation.html#multiviews">content negotiated
68 "MultiViews"</a> resources.</p>
71 <seealso><directive module="core">Require</directive></seealso>
72 <seealso><directive module="core">Satisfy</directive></seealso>
74 <section id="examples"><title>Configuration Examples</title>
76 <section id="examples.file-owner"><title>Require file-owner</title>
77 <p>Consider a multi-user system running the Apache Web server, with
78 each user having his or her own files in <code
79 >~/public_html/private</code>. Assuming that there is a single
80 <directive module="mod_authn_dbm">AuthDBMUserFile</directive> database
81 that lists all of their web-usernames, and that these usernames match
82 the system's usernames that actually own the files on the server, then
83 the following stanza would allow only the user himself access to his
84 own files. User <code>jones</code> would not be allowed to access
85 files in <code>/home/smith/public_html/private</code> unless they
86 were owned by <code>jones</code> instead of <code>smith</code>.</p>
89 <Directory /home/*/public_html/private><br />
92 AuthName MyPrivateFiles<br />
93 AuthBasicProvider dbm<br />
94 AuthDBMUserFile /usr/local/apache2/etc/.htdbm-all<br />
96 Require file-owner<br />
102 <section id="examples.file-group"><title>Require file-group</title>
103 <p>Consider a system similar to the one described above, but with
104 some users that share their project files in
105 <code>~/public_html/project-foo</code>. The files are owned by the
106 system group <code>foo</code> and there is a single <directive
107 module="mod_authz_dbm">AuthDBMGroupFile</directive> database that
108 contains all of the web-usernames and their group membership,
109 <em>i.e.</em> they must be at least member of a group named
110 <code>foo</code>. So if <code>jones</code> and <code>smith</code>
111 are both member of the group <code>foo</code>, then both will be
112 authorized to access the <code>project-foo</code> directories of
116 <Directory /home/*/public_html/project-foo><br />
119 AuthName "Project Foo Files"<br />
120 AuthBasicProvider dbm<br />
122 # combined user/group database<br />
123 AuthDBMUserFile /usr/local/apache2/etc/.htdbm-all<br />
124 AuthDBMGroupFile /usr/local/apache2/etc/.htdbm-all<br />
127 Require file-group<br />
135 <name>AuthzOwnerAuthoritative</name>
136 <description>Sets whether authorization will be passed on to lower level
137 modules</description>
138 <syntax>AuthzOwnerAuthoritative On|Off</syntax>
139 <default>AuthzOwnerAuthoritative On</default>
140 <contextlist><context>directory</context><context>.htaccess</context>
142 <override>AuthConfig</override>
145 <p>Setting the <directive>AuthzOwnerAuthoritative</directive>
146 directive explicitly to <code>Off</code> allows for
147 user authorization to be passed on to lower level modules (as defined
148 in the <code>modules.c</code> files) if:</p>
151 <li>in the case of <code>file-owner</code> the file-system owner does not
152 match the supplied web-username or could not be determined, or</li>
154 <li>in the case of <code>file-group</code> the file-system group does not
155 contain the supplied web-username or could not be determined.</li>
158 <p>Note that setting the value to <code>Off</code> also allows the
159 combination of <code>file-owner</code> and <code>file-group</code>, so
160 access will be allowed if either one or the other (or both) match.</p>
162 <p>By default, control is not passed on and an authorization failure
163 will result in an "Authentication Required" reply. Not
164 setting it to <code>Off</code> thus keeps the system secure and forces
165 an NCSA compliant behaviour.</p>