There are times, after a migration for example, you will need to set the permissions on every file and directory that has been migrated to a cPanel server.
You could do this many ways running "chown" on everything to 755 - then setting each file to 644.
There is an easy way to achieve this with the following linux command. You can copy and paste the command and then hit enter:
NOTE
Ensure you are familiar with the terminal and command line. Running this command in the wrong directory could be fatal to the overall server.
1. Log into the server via SSH (using putty in Windows)
2. Change into the public_html directory of the cPanel account you want to modify
3. Run the following command:
find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \; && chmod 750 .This will change each directory under public_html to the Read/Write/Execute, Read/Execute, Read/Execute. It will also change each file to Read/Write, Read, Read, and change the public_html folder itself to Read/Write/Execute, Read/Execute, Nothing.
This will help secure the site against unwanted attacks.
File and Folder Permissions
Permissions and ownership for files and folders in cPanel accounts can depend on a number of factors: The modules and MPM used by the Apache web server, CageFS, The PHP Handler used, and others. If you are encountering permission related errors on a cPanel account and the above command does not resolve them please contact our support team for assistance.