Method 1. At cPanel user level:
Step::1 Login to cPanel and open File Manager
Steps::2 Scroll over public_html and right click on it and choose Change Permissions option
Step::3 Set the permissions to 0750.
Method 2. At Root level:
Step::1 Login to WHM root and open Server Configuration
Step::2 Open Tweak Settings
Step::3 Go to Security tab and find the option “Enable File Protect”
Step::4 Click over On button and the Save
Method 3. Via Filezilla/SFTP
Step::1 Login to Filezilla as root
Step::2 Go to /root and look for “fixperms.sh” file
Step::3 Open this link- https://pastebin.com/K8Xd4DWy
Step::4 Copy the entire code and paste it fixperms.sh file
Step::5 Now you need to add a Cron Job to the following location- /var/spool/cron and edit the file “root”
Here add an hourly cronjob to hit the file fixperms.sh. Add the line given below and save it:
This cron will hit the file fixperms.sh repeatedly so that the file permission of all the cpanel’s public_html will remain 0750. In this way you can secure public_html.
In this way you can setup file permissions of any file in cPanel.
Visit our Blog for more detials. You can also watch the video here.