[TriLUG] Big Goof (chown -R misstep)

Neil Roeth neil at occamsrazor.net
Tue Jan 20 19:48:22 EST 2004


On Jan 15, Jason Purdy (jason at journalistic.com) wrote:
 > I was pretty close to deploying a new server yesterday when I made a 
 > tragic error.  I was uploading some web materials (/var/www) and hit an 
 > ownership error, so I did a quick:
 > 
 > chown -R jason *
 > 
 > But I accidentally did that in /var instead of /var/www ... and I did 
 > this as root.
 > 
 > Big oops - /var contains mail spools, logs, lock files, etc.
 > 
 > Suffice it to say I've learned my lesson (and did I mention that 
 > /var/www didn't even have subdirectories, so there was no need for the -R).
 > 
 > Since that's happened, I've either chown'd things back to root or 
 > uninstalled the software and reinstalled it, but I'm still having a 
 > small problem with procmail.  The e-mail does get delievered, but it 
 > doesn't look like it's using spamassassin, even though I have an 
 > /etc/procmailrc[1].  Also, in Webmin, there's a module for Spamassassin 
 > administration in the "Servers" section, but when I click on that, it 
 > says the SpamAssassin command /usr/bin/spamassassin was not found 
 > (though it is there).
 > 
 > Does anyone have a Debian box & similar setup (stable Debian 3.0, 
 > postfix, squirrelmail, webmin, usermin and spamassassin) that wouldn't 
 > mind sharing the output of "ls -lR /var" with me?

Did you fix this yet?  I was out of town for a few days, so if you've fixed
the problem, consider this an FYI.

You could install the dchroot and debootstrap packages, create a stable
dchroot, then install the above packages in the dchroot and compare the
permissions between the dchroot and your main system.  Cleanup is easy, just
delete the dchroot.  Off the top of my head, the following should do it.

# apt-get install dchroot debootstrap
# mkdir /chroot
# debootstrap woody /chroot/woody
# echo "woody /chroot/woody" > /etc/dchroot.conf
# cp /etc/apt/sources.list /chroot/woody/etc/apt/
# cp /etc/resolv.conf /chroot/woody/etc/
# dchroot -c woody

(You are now in the dchroot)

# apt-get update
# apt-get install postfix squirrelmail webmin usermin spamassassin procmail
# exit

(You are now out of the dchroot)

# ls -lR /var > var.real
# ls -lR /chroot/woody/var > var.chroot

Then compare the permissions as listed in var.real and var.chroot.

-- 
Neil Roeth



More information about the TriLUG mailing list