Chmod Files as 664 And Directories as 775

By | January 25, 2014

There are some times when the permissions for some files and directories are screwed: 755, 640 .. maybe something even more weird. Of course it would take a lot of time to change the permissions using chmod manually.

The first mistake many people make is to  do a recursive chmod with 664 .. only to find out they can’t chdir into the subdirectories with the owner user. Why? Because directories need execute permissions (that is why you need 775 on them!).

The second mistake many people make is to do a recursive chmod with 775 (or even better: 777!) .. which sets all the files as executable. Nice one! Please don’t ever do that again!

Here is the correct way to set chmod for files to 664 and for directories to 775:

find . -type d | xargs chmod 775
find . -type f | xargs chmod 664

Leave a Reply

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

Time limit is exhausted. Please reload the CAPTCHA.