0

Yesterday my supervisor mounted one of his directories onto my server. The problem is, I can't access them and I have no way of contacting him right now. When I type in the URL I get this error:

Forbidden
You don't have permission to access /~<username>/core/ on this server.

I tried to cd into the "core" directory and do the following:

chmod -R 755 *.*

but, even with all the permissions changed, I still can't get access! The weird thing is, I can access and edit the files.

2
  • my username comes after the ~ in the path
    – eigen93
    Jul 19, 2012 at 19:52
  • How is the directory mounted? Is it a FUSE based filesystem? Please provide the relevant entries from the Apache error logs.
    – mgorven
    Jul 19, 2012 at 20:04

4 Answers 4

4

Apache needs access to every directory in the file system path to /~<username>/core/.

This is almost always a permission problem on /home.

chmod 755 /home/ should fix it for you.

Or the SELinux issue Justin talks about.

1

If you're using SELinux (by default you are) then you need to allow Apache to access user home directories:

setsebool -P httpd_enable_homedirs on

That's all.

1

note that *.* does not mean the same thing in unix that it does in ms-dos and windows. filename "extensions" aren't significant in unix like they are/were in DOS, they're just a part of the string making up the filename.

chmod -R 755 *.* only changes the permissions of files and directories with a '.' in their name. To change all files regardless of whether they have a . or not, try:

chmod -R 755 *

even better, only directories (not plain files) need to be executable, so try something like:

chmod -R a+rX,u+w *

That changes all files to readable for all users, writable by owner, and also sets the execute bit on directories ("X" rather than "x").

0
0

Do you use SELinux on the server? If you are and it's set to 'Enforcing', you may need update the context of the directory to httpd_sys_content_t, otherwise Apache will be denied access.

You can change the context of the directory by doing the following:

chcon -Rv --type=httpd_sys_content_t /~<username>/core

This will change the context of the directory and it's contents to the appropriate context for the HTTPD service (ie. Apache) to work in.

More information can be found here: http://wiki.centos.org/HowTos/SELinux/

1
  • Be careful changing the directory to the "wrong" type; this can cause other problems later. Besides, there's already an easy solution by setting the appropriate boolean. Jul 19, 2012 at 21:41

You must log in to answer this question.