Edit File: disablefileprotect
#!/usr/local/cpanel/3rdparty/bin/perl # cpanel - disablefileprotect Copyright 2016 cPanel, Inc. # All rights Reserved. # copyright@cpanel.net http://cpanel.net # This code is subject to the cPanel license. Unauthorized copying is prohibited use strict; use Cpanel::Config (); use Cpanel::Config::Httpd::EA4 (); use Cpanel::Filesys (); use Cpanel::FileProtect (); use Cpanel::FileProtect::Sync (); use Cpanel::LoginDefs (); use Cpanel::Config::LoadCpConf (); use Cpanel::Config::LoadWwwAcctConf (); $| = 1; display_help() if ( $ARGV[0] eq '--help' ); # For ea4 systems, don't perform ea3 checks my $skip_ea3_check = Cpanel::Config::Httpd::EA4::is_ea4() || ( $ARGV[0] eq '--skip-ea3-check' ); my $cpconf_ref = Cpanel::Config::LoadCpConf::loadcpconf(); my $wwwacct_ref = Cpanel::Config::LoadWwwAcctConf::loadwwwacctconf(); my $home = $wwwacct_ref->{'HOMEDIR'} || '/home'; my $homematch = $wwwacct_ref->{'HOMEMATCH'}; if ( !-e $home ) { mkdir $home; } my $disks = Cpanel::Filesys::get_disk_mounts(); foreach my $mount ( values %{$disks}, $home ) { if ( $mount eq $home || ( $homematch && $mount =~ m/$homematch/ ) ) { print "Setting $mount permissions to 0711...."; chmod 0711, $mount; print "..Done\n"; } } if ( Cpanel::FileProtect->is_on() ) { if ( $skip_ea3_check || Cpanel::Config::httpd_was_built_by_ea3() ) { Cpanel::FileProtect->set_off() or do { die "Error while removing /var/cpanel/fileprotect to disable Fileprotect support: $!"; }; } else { print STDERR "File protection must be disabled from easy/buildapache\n"; exit 1; } } 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"; warn $_->to_string() for Cpanel::FileProtect::Sync::sync_user_homedir( $PW[0] ); } endpwent(); print "...Done\n"; sub display_help { print <<"EO_HELP"; Usage: $0 [--help] Unprotect the public_html directory of each user account so that all users may view its contents. Use the enablefileprotect script to reverse the process. Options: --help - this screen --skip-ea3-check If Apache was compiled by EasyApache 1, Fileprotect must be enabled and disabled from EasyApache. With EasyApache 3, Fileprotect can be enabled and disabled without recompiling. This flag will cause the script to assume Apache was compiled by EasyApache 3 without actually checking. If you used Easyapache 4 to install Apache then this flag performs no action and the system will disable FileProtect. EO_HELP exit; }