1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
|
<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Users' Hierarchies and Personal Home Pages on the WN server</title>
<link rev="made" href="mailto:john@math.nwu.edu">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="last-modified" content="Fri, 09 Oct 1998 18:18:09 GMT">
<meta http-equiv="keywords" content="WN personal home pages">
</head>
<body bgcolor="#FFFFFF">
<p>
<a href="http://hopf.math.nwu.edu/"><img
src="images/powered.jpg"
border="0"
width="190"
height="41"
align="right"
alt="WN home page"
></a>
</p>
<strong>Version 2.0.3</strong>
<br>
<!-- pnuts --> <a href="access.html">[Previous]</a> <a href="multi.html">[Next]</a> <a href="manual.html">[Up]</a> <a href="manual.html">[Top]</a> <a href="dosearch.html">[Search]</a> <a href="docindex.html">[Index]</a>
<br clear="right">
<hr size="4">
<!-- #start -->
<h2 align="center">Users' Hierarchies and Personal Home Pages on the
<em>WN</em> Server</h2>
<hr size="4">
<p>
The <em>WN</em> server allows you to give users on the server their own
private hierarchy for their home page and accompanying documents. The <a
href="http://linux-howto.com/rfc/rfc1500-1999/rfc1738.txt">URL</a> for a
document in such a hierarchy contains a special string (which the
maintainer may choose) to indicate that an alternate hierarchy is being
used. There are three more or less mutually exclusive methods in
<em>WN</em> to do this. One uses user names and consults the system
password file to calculate a "home page" directory in the appropriate
user's home directory. The second uses a table lookup to change the
server root directory to one specified by the maintainer. Both of these
set the data hierarchy based on information in the <a
href="http://linux-howto.com/rfc/rfc1500-1999/rfc1738.txt">URL</a>. A
third method can be used on systems which support multiple IP interfaces
on a single host and will use a different data root for different IP
addresses by which the server is accessed.
</p>
<h3>11.1 <a name="home_directory">Hierarchies in User Home
Directories</a></h3>
<p>
A common idiom on the Web is to use a URL like
"<code>http://hostname/~john/foo.html</code>" to request a document in a
subdirectory of the home directory of user "<code>john</code>".
<em>WN</em> implements this using the first of the mechanisms above.
</p>
<p>
The maintainer uses the macro <a
href="configmacros.html#TILDE_USER_PWFILE"><code>#define TILDE_USER_PWFILE</code></a>
in the configuration file <a
href="configmacros.html"><code>config.h</code></a>, then chooses
'<code>/~</code>' to be the special string and the server consults the
system password file and changes the root data directory to
"<code>/home/john/public_html</code>" (assuming "<code>/home/john</code>"
is "<code>john</code>'s" home directory) and simultaneously deletes the
"<code>/~john</code>". Thus, the URL becomes
"<code>http://hostname/foo.html</code>" with root directory
"<code>/home/john/public_html</code>" so the file accessed is
"<code>/home/john/public_html/foo.html</code>". Both the string
"<code>/~</code>" and the subdirectory "<code>public_html</code>" are
configurable by changing values in <a
href="configmacros.html"><code>config.h</code></a>. They are called <a
href="configmacros.html#TILDE_USER_STRING"><code>#define TILDE_USER_STRING</code></a>
and <a
href="configmacros.html#TILDE_USER_PWFILE"><code>#define PUB_HTML</code></a>
respectively.
</p>
<p>
Thus, to avoid the problematic character '<code>~</code>' a maintainer
might set <a
href="configmacros.html#TILDE_USER_STRING"><code>#define TILDE_USER_STRING</code></a>
to "<code>/people/</code>" and might set <a
href="configmacros.html#PUB_HTML"><code>#define PUB_HTML</code></a>
to "<code>wwwstuff</code>". Then the URL
"<code>http://hostname/people/john/foo.html</code>" would result in the
equivalent of a URL request for "<code>/foo.html</code>" with a data root
of "<code>/home/john/wwwstuff</code>". Note that <a
href="configmacros.html#TILDE_USER_STRING"><code>#define TILDE_USER_STRING</code></a>
must be everything before the user name at the beginning of the URL.
Thus it needs to be "<code>/people/</code>" and not
"<code>/people</code>".
</p>
<p>
As a security measure the maintainer can set a variable <a
href="configmacros.html#LEAST_UID"><code>#define LEAST_UID</code></a>
(with default value 100) in <a
href="configmacros.html"><code>config.h</code></a> and any attempt to use
"<code>/~user/</code>" will fail if the user id of "<code>user</code>" is
less than this value.
</p>
<h3>11.2 <a name="home_directory_alternate">Alternate Hierarchies From a
Table Lookup</a></h3>
<p>
A second method of establishing an alternate data hierarchy does not use
the password file but a table supplied by the maintainer. This method is
enabled by defining the <a
href="configmacros.html#TILDE_TABLE"><code>#define TILDE_TABLE</code></a>
variable in <a href="configmacros.html"><code>config.h</code></a>.
This should be the complete system pathname of a file containing names
and their corresponding data hierarchy directories.
</p>
<p>
For example, if <a
href="configmacros.html"><code>config.h</code></a> contains the
line:
</p>
<blockquote>
<code>
#define TILDE_TABLE /usr/local/etc/wn.dir.table
</code>
</blockquote>
<p>
and the file "<code>wn.dir.table</code>" contains lines like:
</p>
<blockquote>
<code>
john:/home/john/public_html
<br>
bob:/home/bob/public_html
</code>
</blockquote>
<p>
then the URL "<code>http://hostname/~bob/foo.html</code>" will be
translated to a request for "<code>/foo.html</code>" with the data root
directory set to "<code>/home/bob/public_html</code>". The file
consulted should have lines consisting of a name followed by a
'<code>:</code>' followed by the full system path of the desired root
data directory. Of course, the name need not be the name of a user. One
difference with this method is that the <a
href="configmacros.html#PUB_HTML"><code>#define PUB_HTML</code></a>
value from <a href="configmacros.html"><code>config.h</code></a> is not
used and if you want it to be part of the path it should be in the path
part of each entry in your table.
</p>
<p>
This method of changing hierarchies uses the <a
href="configmacros.html#TILDE_USER_STRING"><code>#define TILDE_USER_STRING</code></a>
in precisely the same way that the password file method does. In other
words, if <a
href="configmacros.html#TILDE_USER_STRING"><code>#define TILDE_USER_STRING</code></a>
is defined to be "<code>/people/</code>" instead of '<code>/~</code>'
then "<code>http://hostname/people/john/foo.html</code>" will be
translated to a request for "<code>/foo.html</code>" with root data
directory "<code>/home/john/public_html</code>".
</p>
<p>
More precisely when the <a
href="configmacros.html#TILDE_USER_STRING"><code>#define TILDE_USER_STRING</code></a>
is at the start of the URI it is deleted and everything after it up to
the next '<code>/</code>' is taken to be the name to be looked up in the
table or password file. This name is also discarded and the remainder of
the URI is taken to be the path of the desired document relative to the
new data hierarchy root.
</p>
<p>
When you use the table lookup method to retarget data root directories of
user hierarchies, you can specify a directory that is not even on the
local server host. To do this, specify a lookup table entry consisting
of a name, a double colon (rather than a single colon), and the URL to
the user's data root directory. For example, if user "<code>jim</code>"
has a data root that is accessed as "<code>~jim</code>" on
"<code>otherhost</code>", you can specify the lookup table entry like
this:
</p>
<blockquote>
<code>
jim::http://otherhost/~jim
</code>
</blockquote>
<p>
Then when a client sends a request like
"<code>http://hostname/people/jim/path/file.html</code>" to your server,
the server will return a redirect to the client for
"<code>http://otherhost/~jim/path/file.html</code>".
</p>
<p>
The ability to specify non-local user hierarchies is useful when you run
a primary web server (e.g. "<code>www.your.site.edu</code>") and want all
your users to be able to advertise home page URLs that begin with
"<code>http://www.your.site.edu/</code>" whether or not their accounts
are actually on that host.
</p>
<!-- #end -->
<hr size="4">
<address>
<em>WN</em> version 2.0.3
<br>
Copyright © 1998 <a href="mailto:john@math.nwu.edu">John Franks
<john@math.nwu.edu></a>
<br>
licensed under the <a href="http://www.opencontent.org/opl.html">
OpenContent Public License</a>
<br>
last-modified: Fri, 09 Oct 1998 18:18:09 GMT
</address>
<!-- pnuts --> <a href="access.html">[Previous]</a> <a href="multi.html">[Next]</a> <a href="manual.html">[Up]</a> <a href="manual.html">[Top]</a> <a href="dosearch.html">[Search]</a> <a href="docindex.html">[Index]</a>
</body>
</html>
|