Hello,
For anyone else browsing this thread with the same question, note the referenced option is "Enable File Protect" and is found 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.
It's by design that the /home/$username directory permissions are modified if they are not setup correctly when file protect is enabled. It runs automatically anytime an Apache RPM is updated (which can happen automatically if you have automatic updates enabled). You can view this file directly to get a better idea of how it works on the backend:
Code:
cat /scripts/enablefileprotect
For example, here's the corresponding section related to the home directory permissions:
Code:
print 'Setting permissions for.....';
while ( my @PW = getpwent() ) {
next if ( !$PW[0] || !-e '/var/cpanel/users/' . $PW[0] );
my $useruid = $PW[2];
my $usergid = $PW[3];
next if ( $useruid < Cpanel::LoginDefs::get_uid_min() );
my $homedir = $PW[7];
next if !$homedir || !-d $homedir;
print "$PW[0] …\n";
try {
warn $_->to_string() for Cpanel::FileProtect::Sync::sync_user_homedir( $PW[0] );
}
catch {
print "Skipping $PW[0] because of an error: $_\n";
};
}
endpwent();
print "...Done\n";
Thank you.
Thanks for the explanation of what fileprotect does. Unfortunately it doesn't explain why it is changing the file permissions
incorrectly on this user's home directory.
When this problem happens, we reset the permissions and ownership to the correct ones. Then fileprotect changes the home directory to be owned by nobody with 0750 permissions as if it was a public_html or addon directory. So for this one user, for some reason fileprotect seems to determine that his correct permissions are not so.
In my opinion, because the script is changing his permissions to that of public_html or an addon directory, it must somehow consider his home directory to be an addon directory. I'd like to know whether this is possible and how?
EDIT: I just checked his addon, alias and sub domains...
He has a subdomain with the docroot set to
/ (i.e /home/username). It looks like fileprotect is picking up on this and subsequently setting the permissions accordingly.
I don't think it is possible to set the docroot on a sub, parked or addon to the home directory these days, but as this account is 11 years old, I'm guessing it was at one point allowed.
I'm pretty sure removing that sub domain will resolve the problem. I'll update this thread with results.