Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make all folders in a directory chmod to 755 and individual files to chmod 644. Is there a way I can use umask (e.g. umask 022) to specify these permissions in the future?

Thanks in advance.

share|improve this question
find ~ -type d -exec chmod 755 {} \;
find ~ -type f -exec chmod 644 {} \;

echo umask 0022 > ~/.bashrc # [ this should be in your /etc/profile* already ]
share|improve this answer

You can solve this then using access control lists. man setaclf

Aside from this and or making a cron script that occasionally goes through and makes sure that everything is chmodded correctly in this directory there is no elegant way to go about this in linux.

  • Caveat with acl's, all files created in that directory would have the proper umask applied but any files copied over would have to be chmodded or as stated before you can have a recursive cron script that chmod's the entire directory
share|improve this answer
That change will affect all files and directories created by that user. I took the question to mean 'only in a particular directory'. – EightBitTony Jun 23 '11 at 5:45
Thanks, Your right EightBitTony, I fixed the answer to more appropriately address the question. – Wilshire Jun 23 '11 at 11:58

Your Answer


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.