Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a shared hosting account that uses cPanel and I think su_php. By default, the permissions for my public_HTML directory are set to 750, which allows my site and all folders/files inside public_HTML to be viewable by anyone who visits the site. I'm assuming this is because su_php allows the server to run as my user, thus being able to process php, read files, etc, and serve them to site viewers; rendering any permissions for "other" unnecessary.

But if I set the permissions of any folders within the public_HTML directory to 750 (instead of 755) and I try to visit a page inside that folder, the browser gives me a 403. I'm having trouble understanding why my public_HTML folder can be set to 750, but folders inside it need to be set to 755. If anyone could help me out with this, I'd really appreciate it!

share|improve this question
    
FWIW, I'm not using suPHP and my public_html folders are also set to 0750. –  w3d Jan 27 at 11:11
1  
I think the important thing is that in this instance, the public_html belongs to a different group than all your other files/folders (the Apache UID I think). –  w3d Jan 27 at 12:01
    
Thank you w3d, I believe you are correct. I've edited my original post to reflect this. –  Joe Jan 27 at 15:53
1  
Thanks for the feedback, you can post your EDIT as an answer (it sounds like a very reasonable answer to me) then you can accept it (you can answer your own questions). By accepting your answer it takes it out of the unanswered queue. –  w3d Jan 27 at 16:20
    
Ok, I've done that, thanks for the advice. It won't let me accept my own answer until tomorrow though. –  Joe Jan 27 at 16:53

2 Answers 2

You can access files and folders within the public_HTML because they are not inheriting the 750 rule. Depending on your setup sometimes a child permission can overrule that of a parent, which I'm guessing is the case.

SOURCE: STACK OVERFLOW

0755 = User:rwx Group:r-x World:r-x

0750 = User:rwx Group:r-x World:--- (i.e. World: no access)

r = read

w = write

x = execute (traverse for directories)

share|improve this answer
    
Thanks for the reply. I suppose it could be the case that, as you say, maybe with my provider's setup a child permission can overrule a parent. FWIW, I tried testing this by creating domain.com/test/test2/index.php. I set permissions: public_HTML(750), test(700), and test2(755) to see if test2 would override the settings of test, but it didn't and I got a 403 when I visited domain.com/test/test2/index.php. Maybe they have it set so only the public_HTML directory permissions can be overridden by children? Confusing. Thanks again for taking the time. –  Joe Jan 27 at 3:24
up vote 1 down vote accepted

W3D, you are correct. This comes down to the fact that public_HTML is owned by the group "nobody," of which Apache is a member. Directories and files that I create are part of my own group, and not of the group "nobody." So while Apache is accessing the public_HTML folder, it is a part of that folder's group, hence the need for only 750 permission (which is optimal also because it keeps other users on the same server from being able to view and access my public_HTML folder). But once Apache reaches a directory or file I've created, Apache is no longer a part of it's group. To that directory or file, Apache is actually only qualified as "other." Hence, the need for those directories and files to be set to 755.

Thank you guys for your replies. I can't upvote yet or I would.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.