Set permissions for files and directories in document root

When you need to setup several web sites or if you just experiment with  Docker, you may find useful these commands to set up the permissions for all files and directories in the document root recursive:

To change all the directories to 755 (drwxr-xr-x):

cd /document/root && find . -type d -exec chmod 755 {} \;

To change all the files to 644 (-rw-r–r–):

cd /document/root && find . -type f -exec chmod 644 {} \;

Originally posted by WombleGoneBad on StackOverflow.

Leave a Reply

Your email address will not be published. Required fields are marked *