How to CHMOD all directories to 644 and all files to 755 via SSH

Sometimes we need to adjust access for multiple files or folders, this can be the case if using composer as often the files created will be 0664 which might upset Apache or PHP. To correct this you can use the following commands.

This will recursively chmod all files or folders from the current directory unless you change the directory in the command; it is advised you just run this from the appropriate directory.


find . -type d -print0 | xargs -0 chmod 0755 # For directories


find . -type f -print0 | xargs -0 chmod 0644 # For files