In /var/www, I want all folders (recursively) to have the permissions of 755. I want all files to have the permission of 644. I want all new files and folders to take on these permissions as well.

I've been looking at many examples but I feel like I'm never going to figure this out. Any help would be appreciated.

chmod -R a-rwX /dir
chmod -R u=rwX,g=rX,o=rX /dir
  • This answer should include some more information about what is going on. – kasperd Jun 26 '15 at 8:47

For Files :

find . -type f -exec chmod 644 {} \;

For Folders :

find . -type d -exec chmod 755 {} \;

These will change all the file permissions to 644 and set the permissions to 755 for folders.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.