Every once in a while I need to “fix” the unix permissions on a directory. This is usually a web directory, so all the folders need to be readable and executable (i.e. 755), and the files need to be readable (i.e. 644). A preventative measure might be to set the umask appropriately (i.e. 022), so that there is less of a chance that I’d need to fix things.
However, I still need to be able to go back and fix things. Doing so makes use of some funky looking chmod wizardry:
chmod -R u=rwX,go=rX foldername/
foldername is the name of the folder and contents you want to “fix”. Note that if you are at UVM and on their “zoo” cluster, they have a form that will let you do this to your entire directory. The above snippet does the same thing, but gives you a little more fine grained control over what you are “fixing”.
Update: At the time of writing, I couldn’t find the link to where I found the above recipe.