In a way of troubleshooting web application there is the step when all known reasons why it doesn’t work exhausted so they just change permissions on everything to 0777 and hope that this drastic step would fix the problem. Most likely it does not but leaves the permissions broken and and the whole site wide open.
Usually nobody cares until first break-in, then everybody start looking for the responsible parties, and host is first and most likely last to blame.
In order to avoid this problem permissions (and possibly ownership) of the web content should be corrected.
And the best way to do it is from the shell.
1 2 3 |
# cd /home/user/public_html find . -perm 777 -type f -exec chmod 644 {} \; |
This takes care of files
1 2 |
# find . -perm 777 -type d -exec chmod 755 {} \; |
And this takes care of directories (watch out for some special directories like tmp which might hold local error logs and session files from the web application.
If you need to change the ownership just for few files who belong to the wrong user it can be done the same way:
1 2 |
# find . -user wrong-user -exec chown right-user {} \; |
.
0 Comments.