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.

Trent Scott
  • 959
  • 1
  • 12
  • 28

2 Answers2

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
Wilshire
  • 538
  • 6
  • 19
  • 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 05:45
  • Thanks, Your right EightBitTony, I fixed the answer to more appropriately address the question. – Wilshire Jun 23 '11 at 11:58