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

Posted on 2004-11-25
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/

<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
    LVL 2

    Author Comment

    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.
    LVL 2

    Author Comment

    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

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

    also check the dir/file permissions, see
    LVL 38

    Accepted Solution

    Please  see my answer to the following question:

    Same problem!
    LVL 2

    Author Comment

    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

    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

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now