Index: [Article Count Order] [Thread]

Date:  Thu, 31 Jul 2008 14:46:27 -0700
From:  "Ken Marcus - Precision Web Hosting, Inc." <kenmarcus (at mark) precisionweb.net>
Subject:  [coba-e:13669] Re: apache suexec
To:  <coba-e (at mark) bluequartz.org>
Message-Id:  <000d01c8f356$e5081bb0$6601a8c0@OfficeKen>
References:  <819609.69984.qm (at mark) web65614.mail.ac4.yahoo.com> <0d1e01c8f30a$80a2baf0$967da8c0 (at mark) thomasferrari> <4891B445.1030103 (at mark) virtbiz.com> <4892315A.8060609 (at mark) dogsbody.org>
X-Mail-Count: 13669


----- 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);
}