Fixing UNIX permissions en masse

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/

Where 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.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

You can follow any discussion on this article with the RSS feed for this post.

About this article

Green Galoshes is a weblog written by Justin D. Henry. This entry was published on or around August 22, 2007.

Categories & Tags

This article is filed under code, reference, tools. It is further described as , , , , , , , , , , , , .