Monday, May 9, 2011

chmod on directories and files

(http://movabletripe.com/archive/recursively-chmod-directories-only/)
For directories:

find . -type d -exec chmod 755 {} \;
For Files:
find . -type f -exec chmod 644 {} \;

Cheat sheet:
(http://www.rain.org/~mkummel/unix.html)


execute permission = 1

write permission = 2

write and execute (1+2)= 3

read permission = 4

read and execute (4+1)= 5

read and write (4+2)= 6

read, write and execute (4+2+1)= 7

Add the number value of the permissions you want to grant each group to make a three digit number, one digit each for the owner, the group, and the world. Here are some useful combinations. Try to figure them out!


chmod 600 {filespec}You can read and write; the world can't. Good for files.

chmod 700 {filespec}You can read, write, and execute; the world can't. Good for scripts.

chmod 644 {filespec}You can read and write; the world can only read. Good for web pages.

chmod 755 {filespec}You can read, write, and execute; the world can read and execute. Good for programs you want to share, and your public_html directory.

No comments:

Post a Comment