----- Original Message -----
From: "Dogsbody" <dan (at mark) dogsbody.org>
To: <coba-e (at mark) bluequartz.org>
Sent: Thursday, July 31, 2008 2:40 PM
Subject: [coba-e:13668] Re: apache suexec
>
>> This is an issue that we have observed occasionally with dynamically
>> created content from a CMS such as Joomla or Wordpress or the like. Then
>> a user wants to make changes via FTP and that winds up requiring a
>> support ticket so that our techs can run a quick chown -R for them.
>
> Yeah, I see this a lot too, and to fix a whole site I have to do...
>
> /bin/chgrp -R site11 /home/sites/www.example.com/web
>
> /bin/chmod -R ug+rw,o+r,o-w /home/sites/www.example.com/web
>
> /bin/chmod -R g-w /home/sites/www.example.com/web/awstats
>
> /usr/bin/find /home/sites/www.example.com/web -type d -exec chmod
> g+s,ugo+x {} \;
>
> Dan
To fix the group ownership, I have a cron run this script every hour:
#!/usr/bin/perl
##################################################################
# This script should set the group on all sites
@ls =`ls -1 /home/sites `;
$als = "@ls";
foreach $domainname (@ls){
$theuptime = `uptime`;
chomp ($theuptime);
($top0, $top1, $top2, $top3, $top4, $top5) = split(/,/,$theuptime);
chomp ($top3);
$theload = $top3;
($load1, $load2) = split(/load average:/,$theload);
print "Load is $load2 ";
if ($load2 > 1) {
sleep (30);
print "Load is $load2 sleep 30";
}
if ($load2 > 2) {
sleep (60);
print "Load is $load2 sleep 60";
}
chomp ($domainname);
$custdir = "/home/sites/$domainname/web";
$ls=`ls -la /home/sites | grep -v secure-mall.com | grep $domainname`;
($prev0, $prev1, $prev2, $prev3, $prev4, $prev5) = split(/\//,$ls);
chomp ($prev3);
$preview = "$prev2/$prev3";
$sitenumber = $prev3;
system ("chgrp -R $sitenumber $custdir ");
print "did this chgrp -R $sitenumber $custdir\n";
sleep (1);
}