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_authz_owner.xml.meta">
25 <name>mod_authz_owner</name>
26 <description>Authorization based on file ownership</description>
27 <status>Extension</status>
28 <sourcefile>mod_authz_owner.c</sourcefile>
29 <identifier>authz_owner_module</identifier>
30 <compatibility>Available in Apache 2.1 and later</compatibility>
33 <p>This module authorizes access to files by comparing the userid used
34 for HTTP authentication (the web userid) with the file-system owner or
35 group of the requested file. The supplied username and password
36 must be already properly verified by an authentication module,
37 such as <module>mod_auth_basic</module> or
38 <module>mod_auth_digest</module>. <module>mod_authz_owner</module>
39 recognizes two arguments for the <directive module="mod_authz_core"
40 >Require</directive> directive, <code>file-owner</code> and
41 <code>file-group</code>, as follows:</p>
44 <dt><code>file-owner</code></dt>
45 <dd>The supplied web-username must match the system's name for the
46 owner of the file being requested. That is, if the operating system
47 says the requested file is owned by <code>jones</code>, then the
48 username used to access it through the web must be <code>jones</code>
51 <dt><code>file-group</code></dt>
52 <dd>The name of the system group that owns the file must be present
53 in a group database, which is provided, for example, by <module
54 >mod_authz_groupfile</module> or <module>mod_authz_dbm</module>,
55 and the web-username must be a member of that group. For example, if
56 the operating system says the requested file is owned by (system)
57 group <code>accounts</code>, the group <code>accounts</code> must
58 appear in the group database and the web-username used in the request
59 must be a member of that group.</dd>
62 <note><title>Note</title>
63 <p>If <module>mod_authz_owner</module> is used in order to authorize
64 a resource that is not actually present in the filesystem
65 (<em>i.e.</em> a virtual resource), it will deny the access.</p>
67 <p>Particularly it will never authorize <a
68 href="../content-negotiation.html#multiviews">content negotiated
69 "MultiViews"</a> resources.</p>
72 <seealso><directive module="mod_authz_core">Require</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>
88 <highlight language="config">
89 <Directory /home/*/public_html/private>
91 AuthName MyPrivateFiles
93 AuthDBMUserFile /usr/local/apache2/etc/.htdbm-all
99 <section id="examples.file-group"><title>Require file-group</title>
100 <p>Consider a system similar to the one described above, but with
101 some users that share their project files in
102 <code>~/public_html/project-foo</code>. The files are owned by the
103 system group <code>foo</code> and there is a single <directive
104 module="mod_authz_dbm">AuthDBMGroupFile</directive> database that
105 contains all of the web-usernames and their group membership,
106 <em>i.e.</em> they must be at least member of a group named
107 <code>foo</code>. So if <code>jones</code> and <code>smith</code>
108 are both member of the group <code>foo</code>, then both will be
109 authorized to access the <code>project-foo</code> directories of
112 <highlight language="config">
113 <Directory /home/*/public_html/project-foo>
115 AuthName "Project Foo Files"
116 AuthBasicProvider dbm
118 # combined user/group database
119 AuthDBMUserFile /usr/local/apache2/etc/.htdbm-all
120 AuthDBMGroupFile /usr/local/apache2/etc/.htdbm-all