Script for correcting the directory and file permission
Script for correcting file permission
Sometimes the issues occurred due to permissions. In this guide you can learn how to correct the permissions of the file and directories.
The default file permission is 644
The default directory permission is 755
Use the following script for correcting the file permission and directory permission.
find . -type d -print0 | xargs -0 chmod 755;find . -type f -print0 | xargs -0 chmod 644
Here ‘ . ‘ Represents the current location.
For example, if you want to change the permission of directories and files under /home/user/public_html
# cd /home/user/public_html Run the above scripts
An alternate method is you can replace ‘ . ‘ with location/path you want to change.
If you want to change the permissions of files and directories under /home/user/public_html
find /home/user/public_html -type d -print0 | xargs -0 chmod 755;find /home/user/public_html -type f -print0 | xargs -0 chmod 644
Try this above script if you have problem with files and directory permissions