Fix File Permission on Linux/Mac Server

Over the time, file permissions get messy on a linux/mac server. It really annoys (me) to see static files like images have 0755 i.e. executable permission set for them.

You can use following commands to fix permissions:

find . -type d -print0 | xargs -0 chmod 0775
find . -type f -print0 | xargs -0 chmod 0664

I found many scripts and tools to do this job. IMHO, above command does what we really need!

For WordPress

Ideally, on a wordpress site, no files under “wp-content/uploads” directory should be executable. In case of WordPress multisite, it will be “wp-content/blogs.dir” directory.

Its better to fix file-permissions periodically on your WordPress setup.