Skip to main content

Recursively set all file and folder permissions

Let’s say your current working directory is full of subdirectories and files. You want all the subdirectories to have one set of file permissions (say, 664), and all of the files to have a different set of permissions (for example, 775).

The Hardening WordPress documentation, has a handy pair of commands to do that.

sudo find . -type d -exec chmod 775 {} \;
sudo find . -type f -exec chmod 664 {} \;

Right, now I’ve posted this, I can get rid of that random text file I’ve been keeping around.

Next post:

Previous post: