Setting File and Folder Permissions

I find these two commands really useful when I want to ensure that I have folder and file permissions correct for a website.   Sometimes during development I’ll set them to 664 and 775 as I need the web group to have the same permissions as me but on live production servers you will tend to go with the defaults below.

You can reset file permissions with the line (don’t forget slashes before the semicolon):

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

and folder permissions with:

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

Leave a Reply

Your email address will not be published.

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