How to fix permissions of Files and Directories on a cPanel Server
How to fix permissions of Files and Directories on a cPanel Server
The below command will list all the files which are not having 644 permission
find \! -perm 644 -type f
The below command will show all directories which are not having 755 permission
find \! -perm 755 -type d
Do the below to correct the permission of files and directories under a website. The below command will set file permission as 644 and directory permission as 755.
Note : The below commands should be run ONLY within document root of the website. Running the command outside document root of your website will lead to issues.
Command to correct the permission of directories under a website :
find . -type d -exec chmod 755 {} \;
Above command will set 755 permission for all directories.
Command to correct the permission of files under a website :
find . -type f -exec chmod 644 {} \;
Above commands will set 644 permission for all files and 755 permission for Directories.