From: "James T. Dennis" <jadestar@idiom.com>
Subject: Re: Help: Apache Web server
Date: 22 Sep 2000 00:11:52 GMT [thread overview]
Message-ID: <8qe848$2sgb$1@news.idiom.com> (raw)
In-Reply-To: 39CA654B.9B820291@nospam.guacamole.com
In comp.os.linux.alpha Marble Head <Marble.Head@nospam.guacamole.com> wrote:
>> cd /home
>> chmod 711 ~user
>> chmod 755 ~user/public_html
>> chmod 644 ~user/public_html/<files/here>
>> chmod 755 ~user/public_html/<dirs/here>
> Have you tried this?
> It doesn't seem to make sense to me. Why the ~ in front of user?
> Is that a special folder somebody created, or is it part of
> their login name, or a type-o, or something I don't understand?
It's something you don't understand. It's also pretty basic
UNIX/Linux so it is generally assumed that users will understand
it. From most (almost all) UNIX shells (command line interpreters/
interfaces) the ~ (tilde or "twiddle") is an abbreviation for
"the home directory of." So ~/foo is the "foo" file or directory
under (the current user's) home directory. ~foo/bar is "the
bar file or directory under the home directory of the user named
"foo." (Note that "foo" and "bar" are traditional "meta variables"
--- the are used in examples just the way that you math teacher
might have used "a" and "b").
In common URL usage the ~ has a similar meaning. The NCSA
Apache and many other web servers are configured to take a
URL of the form ~foo (as in http://somewhere.not/~foo/bar.html)
and expand it to "the public_html directory under the home
directory of user foo." This is a slightly different but
rather "intuitive" interpretation to people who are used to
the common UNIX meaning of the ~. Considering that the
web and the Inernet were primarily developed by UNIX programmers
and users this makes alot of sense.
It's possible that your web server may be configured to
treat ~ characters in URLs differently. For example I usually
configure my systems to use ~*/.web/ instead of ~*/public_html/
as "the user's web files." That's because I prefer the shorter
name and I don't need to see my "web" directory tree every time
I do an ls in my home directory.
It's also possible that your web server might be configured
to ignore the ~ completely. Also note that it is technically
not strictly conformant with the standards to put a ~ in a
URL --- it's supposed to be encoded (%7E??) though it's quite
rare in practice.
> Also, on my system, in order for httpd to reach the
> /home/joeuser/public_html/* files, all of those paths needed
> to be read and execute permissions, in other words, 755.
Should read: "those paths need to be 'world accessible'..."
Technically you just have to make sure that your
public_html directory is accessible to the web server. The
web server should be running under its own special user ID
(often named "web"). You might be able to accomplish this
with just group permissions (mode 750 on public_html and
possibly on your home directory as well). However, it's
usually pretty unlikely that you'd want to serve web pages
from a "public_html" directory that you would want to keep
confidential from other local users. It's possible to do
that sort of think using CGI programs and the Apache suExec
module if you really need to.
> Here's another idea:
> In the apache configuration files somewhere, there must be a
> setting that tells it "When you get a request for
> http://www.domain.com/~user, look in the /home/user/public_html
> folder," because not every system puts the users under /home.
It is correct that there is such a setting. However, that is
completely indepedent of the fact that some users might have
home directories that are not under /home.
The normal UNIX mechanism for looking up a user's home
directory (and for matching numeric UIDs to user names, and
for looking up other "locally public" information about any UNIX
account is to use the getpwent() library functions. This
could provide a directory name under /home for one user and
a directory under /usr/share for another, etc.
The getpwent() function traditionally looked through the
/etc/passwd file. On modern versions of UNIX it might
look up information via a set of NIS maps, it might access
a set of dbm "hash/index" files, or it might use other
mechanisms. On a GNU/Linux or other GNU system (one using
the GNU glibc 2.x libraries) it might involve the library
loading various .so (shared object) files and querying
any sort of back-end directory service (LDAP, Hesiod, etc).
So, if the ~ feature of your web server is enabled it is
not likely to be doing a simple string replacement of
~ with something like /home/.../public_html/ --- it's almost
certainly doing a proper getpwent() and then appending the
"public_html" or other directory name to the end of that.
> So that setting must be changeable, for example, to
> /home/personalpages/user. If the users want the public_html
> folder in their regular /home/user folder, make a softlink.
The web server might be configured not to follow symbolic links.
> Allow the full 755 permissions on /home/personalpages, because
> if it's public anyway (accessible through http://www.domain.com/~user)
> then who will be upset that somebody read it? And you still can
> preserve normal permissions on your /home/user folder.
Actually it is possible (if one was using .htaccess) that one
might want to keep "confidential" data under a ~/public_html/
directory tree. One news poster recently posed a question
(I don't remember where) that described a set of patches to
their web server that caused the web server to adopt the
same effective user ID as the owner of a file/directory that
was listed in the URL. This allegedly provided the desired
level of additional security (although it seems quite risky
since it might have had its own bugs that make the whole
server MUCH more dangerous; I'd recommend a mechanism where
the primary web server could "hand off" any ~foo/ URL requests
to a different process (file descriptors, including those
bound to internet domain sockets can be passed via UNIX domain
sockets) and have each user that wanted this sort of
feature running a custom process (probably running with a
specific supplemental group) --- that should be much safer).
next prev parent reply other threads:[~2000-09-22 0:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-09-19 4:00 Help: Apache Web server Pixel
2000-09-19 4:00 ` sideband
2000-09-19 4:00 ` Pixel
2000-09-19 4:00 ` sideband
2000-09-19 14:12 ` Pixel
2000-09-19 14:14 ` Pixel
2000-09-19 4:00 ` sideband
2000-09-19 4:00 ` Marble Head
2000-09-20 3:59 ` Pixel
2000-09-20 4:00 ` sideband
2000-09-21 4:00 ` Sally Woolrich
2000-09-20 4:00 ` Mamata Desai
2000-09-21 4:00 ` Marble Head
2000-09-22 0:11 ` James T. Dennis [this message]
2000-09-23 4:00 ` Gunnar Gaubatz
2000-09-23 4:00 ` Pat Gunn
2000-09-24 4:00 ` Gunnar Gaubatz
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox