Linux: Setting File Permissions On Folders and Directories

To set all the files and folders in a directory to 755 use chmod:
chmod -R 755 /foo/bar

To set the directories to 755 and set the file to 644 for this you can use the find command e.g.
to change all the directories to 755:
find /foo/bar -type d -exec chmod 755 {} \;
to change all the files to 644:
findĀ /foo/bar -type f -exec chmod 644 {} \;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.