Error 403 Forbidden in /~user/ directories with apache 2 and mod_userdir

Posted on 2004-11-25
Medium Priority
Last Modified: 2012-08-14
Just upgraded to Fedora Core 3 and now I am having trouble configuring apache.

My httpd conf file contains the following (just snipping out the parts that look important for size purposes)

LoadModule userdir_module modules/mod_userdir.so

<IfModule mod_userdir.c>
    UserDir public_html

<Directory /home/*/public_html>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
        Order allow,deny
        Allow from all

Now, when I acces http://localhost/ it loads the apache test page and everything looks great. But when I try http://localhost/~buck/ or http://localhost/~buck/index.html or any other file in my public_html directory, I get a -

"You don't have permission to access /~buck/ on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."

I've googled for hours and have read plenty of threads involving the same problem, but it almost always turns out to be a problem with permissions, but I've checked over and over and my permissions look good to me.

drwxr-xr-x /home
drwx-----x  /home/buck
drwxr-xr-x /home/buck/public_html
-rwxr--r--    /home/buck/public_html/index.html

Upon logging on another user in a seperate group, the expected results occur when listing the public_html folder and opening the index file.

ls /home/buck/public_html/
Gives me a list of all the files in my public_html

cat /home/buck/public_html/index.html
Gives me the source to my index page.

My question is, if this user with no special privileges, can read these files... why can't apache seem to do the same?
Question by:bgbuck7
  • 3
  • 2

Author Comment

ID: 12678097
OK, nevermind about everything else working fine... This is very strange. look at this:

>[root@localhost html]# ls -l -R
>total 24
>-rw-r--r--  1 root root    5 Nov 25 20:28 test
>drwxr-xr-x  2 root root 4096 Nov 25 20:32 testdir
>drwxr-xr-x  2 root root 4096 Nov 25 20:32 testdir2
>total 8
>-rw-r--r--  1 root root 5 Nov 25 20:32 test
>total 8
>-rw-r--r--  1 root root 5 Nov 25 20:32 test

Now when I get http://localhost/ I show's me a directory listing containing test and testdir... there's no testdir2!  As you can see, the permissions and contents of the directories are identical.... The only difference is that testdir2 was moved to /var/www/html/ from a different directory using mv.

Author Comment

ID: 12678942
I fixed it. And it wasn't a problem with my apache or my permissions... Apache was being interfered with by SELinux. I disabled SELinux for just httpd and it works fine now. I'm seriously contemplating removing SELinux from my computer, for one I don't really trust anything from the NSA, and two, it really doesn't seem to help secure anything, just break stuff.
LVL 38

Expert Comment

ID: 12679022
check your error_log file, to see the cause of the problem.

also check the dir/file permissions, see
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

LVL 38

Accepted Solution

yuzh earned 2000 total points
ID: 12684710
Please  see my answer to the following question:

Same problem!

Author Comment

ID: 12688641
Reading comments before trying to answer always helps :-p Turned out to be a completely different problem, but thanks for the help anyways.

Expert Comment

ID: 14586556
I fixed it. And it wasn't a problem with my apache or my permissions... Apache was being interfered with by SELinux. I disabled SELinux for just httpd and it works fine now.

There is not a problem with SELinux.
Check out this URL on SELinux and Apache with Fedora.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month17 days, 6 hours left to enroll

862 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