Public html folder permission changes automatically

Nov 30, 2017
5
0
1
india
cPanel Access Level
Root Administrator
Hi all cpanel experts here

I am not a server administrator but do have root access to my servers, my issue is that on few of my websites (which are built in wordpress mostly), htaccess file content either gets changed automatically or htaccess file removed, I checked all my code and there is no virus or malware infection, and we dont see any such issue, to secure more, I tried changing public_html folder permission to 555 and also for htaccess to 444 but if I do so, not sure because of which process but my public html folder permission automatically gets reset to 750 and due to that htaccess is removed also

Can someone help me figuring out the issue.
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
87
78
cPanel Access Level
DataCenter Provider
The public_html directory should be 750 and is not intended to be changed. Setting 555 would make your public_html directories readable across account, which is a nightmare security wise especially with multiple WP sites. Generally this is a bad idea for that reason, which is why the file protect feature in WHM/cPanel will revert those permissions on public_html directories.

Regarding .htaccess what is the exact path of the .htaccess file that is being affected? Do you think cPanel is affecting it, or is it just affected in your scenario due to the change in permissions on public_html itself? I don't recall a reason that setting 444 on a .htaccess file would be an issue.
 

rpvw

Well-Known Member
Jul 18, 2013
1,101
457
113
UK
cPanel Access Level
Root Administrator
Check to see if "Enable File Protect" is enabled under the "Security" tab in "WHM >> Tweak Settings". The File Protect functionality will check the permissions and ownership values on each user account's home and public_html directories and each addon domain's DocumentRoot directory and then set the values accordingly.