Fedora Core 4 and SELinux paranoia

The default configuration of Fedora Core 4 with SELinux enabled causes problems when you want to use the UserDir feature in Apache Httpd.

Problem:

SELinux is stopping the httpd processes from accessing your home directory.

Forbidden

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

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.0.54 (Fedora) Server at localhost Port 80

Solution:

From your shell ...

[foo@localhost ~]$ chcon -R -t httpd_user_content_t public_html/

If you get the following...

[foo@localhost ~]$ chcon -R -t httpd_user_content_t public_html/
chcon: failed to change context of public_html/index.html to root:object_r:httpd_user_content_t: Operation not permitted

It's probably because "index.html" is zero-length, I just placed an empty file in public_html and it failed first time, I removed the file and it went through the rest of it just fine.

Related Links:
http://the.taoofmac.com/space/Fedora
http://fedora.redhat.com/docs/selinux-faq-fc3/index.html#id2825658