[CentOS] Problems with UserDir directive on CentOS 5

Daniel de Kok danieldk at pobox.com
Sun Jun 10 10:38:25 UTC 2007


Hi Niki,

On Sun, 2007-06-10 at 12:17 +0200, Niki Kovacs wrote:
> I open Firefox at http://localhost/~kikinovak/
> 
> ... and I get the following error message:
> 
> Forbidden
> 
> You don't have permission to access /~kikinovak/ on this server.
> Apache/2.2.3 (CentOS) Server at localhost Port 80
> 
> Q: what did I do wrong? (I've done this successfully on Slackware and 
> Debian before)

Probably two things:

* Apache needs directory access permissions (x) on each path component
in /home/kikinovak/public_html. They are probably missing
on /home/kikinovak:

chmod +x /home/kikinovak

I'll let you think about the security implications ;).

* If you are using SELinux, you need to make sure the right context is
set for /home/kikinovak/public_html. You can see the current context
with "ls -Z", e.g.:

---
$ ls -dZ public_html
drwxrwxr-x  daniel daniel user_u:object_r:user_home_t      public_html
---

You can set the proper context (httpd_sys_content_t or
httpd_user_content_t) with chcon:

---
chcon -R -t httpd_sys_content_t public_html
---

or restorecon (since this directory should already be in the predefined
contexts):

/sbin/restorecon -R public_html

-- Daniel




More information about the CentOS mailing list