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>
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="mod_authz_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="mod_authz_core">Require</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>
87 <highlight language="config">
88 <Directory "/home/*/public_html/private">
90 AuthName "MyPrivateFiles"
92 AuthDBMUserFile "/usr/local/apache2/etc/.htdbm-all"
98 <section id="examples.file-group"><title>Require file-group</title>
99 <p>Consider a system similar to the one described above, but with
100 some users that share their project files in
101 <code>~/public_html/project-foo</code>. The files are owned by the
102 system group <code>foo</code> and there is a single <directive
103 module="mod_authz_dbm">AuthDBMGroupFile</directive> database that
104 contains all of the web-usernames and their group membership,
105 <em>i.e.</em> they must be at least member of a group named
106 <code>foo</code>. So if <code>jones</code> and <code>smith</code>
107 are both member of the group <code>foo</code>, then both will be
108 authorized to access the <code>project-foo</code> directories of
111 <highlight language="config">
112 <Directory "/home/*/public_html/project-foo">
114 AuthName "Project Foo Files"
115 AuthBasicProvider dbm
117 # combined user/group database
118 AuthDBMUserFile "/usr/local/apache2/etc/.htdbm-all"
119 AuthDBMGroupFile "/usr/local/apache2/etc/.htdbm-all"