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