Solved

Apache setup for users

Posted on 2000-03-15
11
224 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

696 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