Showing posts with label chmod. Show all posts
Showing posts with label chmod. Show all posts

Wednesday, August 13, 2008

Change Permissions on All Directories

Sometimes I need to recursively set permissions on all directories in a file hierarchy. Other times, I just want to set file permissions while ignoring directories. Fortunately, the find command makes this easy.

# make all directories read, write, execute for owner. read, execute for group and other
find . -type d -exec chmod 755 {} \;

# make all files read, write for owner. read for group and other
find . -type f -exec chmod 644 {} \;

# make all shell scripts read, write, execute for owner. read, execute for group and other
find . -type f -name "*.sh" 755 {} \;