Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
2  
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
add comment
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
add comment

Your Answer

 
discard

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.