Restore file & folder default permissions

/ Published in: Bash
Save to your folder(s)

When modifying file permissions it is sometimes necessary to go back to the drawing board and set back to the default permissions. The following command can be used via ssh and takes a couple seconds vs trying to do this via ftp file by file (which can take a very long time depending on the size of your website). Change to the directory you want changed, then run the following. It will set permission for all files to 644 and all directories to 755. This works for pretty much any Linux server.

Copy this code and paste it in your HTML
  1. find . -type f -exec chmod 644 {} \;
  2. find . -type d -exec chmod 755 {} \;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.