The EasyApache 4 FileProtect Option
Last modified: 2024 August 30
Overview
The EasyApache FileProtect option improves the security of each cPanel user’s public_html and addon domain document root directories by allowing only Apache and the user to view their contents.
In EasyApache 4, the system enables this option by default.
Functionality
When you enable the FileProtect option, EasyApache performs the following actions:
-
Creates the
/var/cpanel/fileprotectfile.Note:When you disable this option, EasyApache removes this file. -
Executes the
/usr/local/cpanel/scripts/enablefileprotectscript, which sets more secure permissions for each cPanel user’s/public_htmldirectory. -
Sets the cPanel user’s
/home/username/directory to0711permissions. -
Sets all document root directories’ GroupID to the
nobodyuser with0750permissions.Note:If you enable the
mod_ruid2ormod_mpm_itkApache modules, EasyApache will set all document root directories’ GroupID to theusernameuser.
When you disable this option, EasyApache resets permissions to their default settings, even if you have modified them elsewhere. To do this, EasyApache performs the following actions:
-
Resets the user’s
/home/username/directory to0711permissions. -
Resets the user’s
/home/username/public_htmldirectory Group ID to theusernameuser and0711permissions. -
Resets each addon domain’s document root directory to
0711permissions.
Enable or disable FileProtect
Requirements
This option does not possess any requirements.
Compatibility
This option does not possess any known compatibility issues, and works when you enable the mod_ruid2 Apache module.
Tweak Settings
You can enable or disable the FileProtect option in WHM’s Tweak Settings interface (WHM » Home » Server Configuration » Tweak Settings) with the Enable File Protect option. This option appears in the Security section and defaults to on.
Command line
To enable the FileProtect option via the command line, connect via SSH as the root user and run the following script:
/usr/local/cpanel/scripts/enablefileprotectTo disable the FileProtect option, connect via SSH as the root user and run the following script:
/usr/local/cpanel/scripts/disablefileprotectFor more information about these scripts, run these scripts with the --help flag.