Somebody whacks your file permissions by issuing sudo chmod 0777 -R *
and all your directories and files are colored green (if you know what I mean). That is a bad thing for file permissions especially for files for your web application. You can set the correct permission with a few commands.
Setting directory permissions recursively
Under normal situations, directory permissions should be 0755
which means only the owner has read-write-execute permissions and the rest only have read-execute.
find . -type d -exec chmod 0755 {} \;
Setting file permissions recursively
For files, normally it is 0644
where owner has read-write and the rest has read-only permissions. No execute permission is needed for files that are not executables.
find . -type f -exec chmod 0644 {} \;
You can set more restrictive permissions as you wish by simply changing the permission code.
Enjoy and share.
Looks like I’ve written this already: http://blog.lysender.com/2010/12/whacking-file-permissions-after-deploying/