Hey,
I'm using the modified chownpublichtmls script below to update files in every account in /home. When I run the script, every account gets locked out and receives a 403 Forbidden error.
Is there any way to avoid the 403 error when I update the files? Is it really neccessary to lock people out when chowning or copying files?
BTW, I don't know if it matters but I'm running PHP as cgi with phpsuexec.
Thanks!
I'm using the modified chownpublichtmls script below to update files in every account in /home. When I run the script, every account gets locked out and receives a 403 Forbidden error.
Is there any way to avoid the 403 error when I update the files? Is it really neccessary to lock people out when chowning or copying files?
BTW, I don't know if it matters but I'm running PHP as cgi with phpsuexec.
Thanks!
Code:
#!/usr/bin/perl
BEGIN {
push(@INC,"/scripts");
}
require '/scripts/safetybits.pl';
while(@PW=getpwent()) {
if (-d "$PW[7]/public_html" && -e "/var/cpanel/users/$PW[0]") {
print "Copying and Chowning $PW[0]....";
$account = $PW[0];
if ($account ne "imsdirec"){
system("cp -rf /root/cpanel3-skel/public_html/admin /home/$PW[0]/public_html");
system("cp -rf /root/cpanel3-skel/public_html/cncat /home/$PW[0]/public_html");
system("cp -rf /root/cpanel3-skel/public_html/shared_files /home/$PW[0]/public_html");
#system("cp -rf /root/cpanel3-skel/public_html/.htaccess /home/$PW[0]/public_html");
system("cp -rf /root/cpanel3-skel/public_html/download.php /home/$PW[0]/public_html");
system("cp -rf /root/cpanel3-skel/public_html/index.php /home/$PW[0]/public_html");
print "Copy done...";
}
safe_recchown($PW[2],$PW[3],"$PW[7]/public_html");
print "chown Done\n";
}
}
exec '/scripts/enablefileprotect';