I needed to change all the php files in a web project to 644 when they were all actually set to 755, and all the folders to 755 when they were set to 700. Here’s how it’s done.
To set all the folders to 755:
find . -type d -exec chmod 755 {} \;
To set all files to 644:
find . -type f -exec chmod 644 {} \;
To set only files that end with .php to 755 (pattern escaped with slashes)
find . -name \*\.php -exec chmod 755 {} \;
You get the idea. Basically, we’re using the find
utility to pick out the files we’re wanting to work with, and executing chmod
over them.
Hey thanks for this post, it helped me :)
You made a slight typo for changing php file permissions to 755, in that you have written ‘644’.
— munkychop · Aug 13, 09:29 PM · #