2

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.

2 Answers 2

1
find ~ -type d -exec chmod 755 {} \;
find ~ -type f -exec chmod 644 {} \;

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

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
2
  • 2
    That change will affect all files and directories created by that user. I took the question to mean 'only in a particular directory'. Jun 23, 2011 at 5:45
  • Thanks, Your right EightBitTony, I fixed the answer to more appropriately address the question.
    – Wilshire
    Jun 23, 2011 at 11:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .