Use SSH to change file and directory permissions to 0644 and 0755

Rudtek Knows Ssh

Often we find ourselves needing to bulk change all file permissions or all directory permission for an entire site or directory. Here at Rudtek, we have received calls because a site is down with an error 500 (looking at you WordPress!) This is caused by servers, or users, applying the wrong permissions to a file on the site.

Rather than looking through all the files for the culprit, it’s easier to make sure all permissions are set properly. In this case directories should be 0755 and files should be 0644.

To do this with your individual ftp client can be extremely time consuming.

To separate these out you can to log into your server or hosting account via SSH, navigate to the directory you want to start the change in and type:

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

or

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

This will recursively find and apply the CHMOD accordingly for the file types. F = Files & D = Directories respectively.