Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Jul 19 '12 at 19:53

This question came from our site for professional and enthusiast programmers.

    
my username comes after the ~ in the path –  eigen93 Jul 19 '12 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 '12 at 20:04

4 Answers 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.

share|improve this answer

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.

share|improve this answer

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").

share|improve this answer
    
worked like a charm. Thank you. –  user1167442 Mar 22 at 0:39

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/

share|improve this answer
    
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. –  Michael Hampton Jul 19 '12 at 21:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.