Solved

Apache setup for users

Posted on 2000-03-15
11
220 Views
Last Modified: 2013-12-15
Hello,

Having a bit of trouble getting userdirectories to work with Apache.

I want to give my users the ability to publish web content (with cgi ability too).  I played around with the appropriate section in httpd.conf, but to no avail (all I get are HTTP 403's).

Example user dir: /home/cubedweller/public_html
permissions: rwxrwxr-x
Example html file: .../public_html/index.html
permissions: rw-rw-r--
Example URL: http://servername/~cubedweller/

Does anyone know how to set it up so users only have access to their directories, and can use cgi?

Thanks in advance,
CubeDweller
0
Comment
Question by:cubedweller
  • 5
  • 5
11 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 2620984
UserDir's have changed a bit in the latest version of Apache, what version are you using?
0
 

Author Comment

by:cubedweller
ID: 2621275
I am using version 1.3.9-8
You may recall from an earlier question that things broke when I tried to upgrade to the latest version (1.3.12).

Thanks
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2621324
Ah yes, I remember now. Let me get to one of my 1.3.9 servers and I'll pull a piece of the config file.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 2

Expert Comment

by:bernardh
ID: 2621384
it's simple as creating the user's directory under /home/httpd/html, so if you create an index.html file on /home/httpd/html/user_dir you can view the his page by going to http://servername/user_dir
0
 

Author Comment

by:cubedweller
ID: 2621890
Unfortunately, that did not quite work.  Yes, I could create subdirectories with the usernames, but that was not the point.

As far as I understand from the Apache documentation, the users' directories live under their home directories (default config is for ~username/public_html/).  This allows them access to their content, without undue access in the web root.

Additionally, Apache seems to need a cgi-bin alias within that user directory.  The alternative is to open up the permissions on the main cgi-bin directory, something which strikes me as bad.

Any ideas?

Thanks.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2621982
You are correct in the way Apache treats the UserDir directive. As shipped, 1.3.9 has it defined as "UserDir public_html" which expands to "$usename/public_html". For Apache to gain access to the the personal pages, it has to be able to access them. Since Apache is usually running as nobody, the user's home dir and public_html dir must have at least execute perms for world (o+x) or else you'll get the 403 error. Also the files in public_html must be world readable (o+r).

The crux of your question, as I see it, is how to define an "Options ExecCGI" for the userdir's. I though I had seen something about this, although I haven't been able to locate it so far.
0
 
LVL 40

Accepted Solution

by:
jlevie earned 40 total points
ID: 2622015
Okay, I found the reference about personal cgi-bins. It works for me because all of our home dirs are automounted in /home (although it would also work if they were all in one or a few filesystems). And it goes like this:

ScriptAliasMatch /~([^/])/cgi-bin/(.*) /home/$1/cgi-bin/$2

I think that provides the last piece...
0
 

Author Comment

by:cubedweller
ID: 2625683
Jlevie,

Almost there.  The user's directory is now viewable, but can't get the user's cgi-bin to work.

Can you tell me exactly what to do, including what path should appear in the html file (e.g. method=get action="/cgi-bin/script.cgi")

A newbie still learning to crawl,
CubeDweller
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2625720
What has to be in a users html file to access a personal cgi's would be something along the same lines as would be used to access their personal pages, e.g., for user "billybob" the html pages would be at http://server-fqdn/~billybob/ and the cgi's would be http://server-fqdn/~billybob/cgi-bin/script.cgi.
0
 

Author Comment

by:cubedweller
ID: 2628639
Sorry for the handholding.

I have tried using your scriptalias line in place of and in addition to the default one already in the httpd.conf file, restarting httpd everytime.

I have also tried multiple variations of the path, including:
/home/billybob/cgi-bin/script.cgi
/home/billybob/public_html/cgi-bin/script.cgi

Inside the calling html file I have also tried variations including:
action="cgi-bin/script.cgi"
action="/cgi-bin/script.cgi"
action="../cgi-bin/script.cgu"

The script is executable, and the permissions seem right.

Maybe it would also help me if I understood that expression in the ScriptAliasMatch.

Thanks,
CubeDweller

0
 

Author Comment

by:cubedweller
ID: 2781663
Thanks.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question