From: Jon Nelson
Date: Fri, 28 Oct 2005 08:34:24 -0500 (CDT) Cc: Subject: Re: [SLE] Major oops with chown On Fri, 28 Oct 2005, Ian Marlier wrote:
From: Andreas Jaeger
Date: Fri, 28 Oct 2005 08:34:23 +0200 To: Bert Plat Cc: Subject: Re: [SLE] Major oops with chown Bert Plat
writes: Well, they told me Linux was powerful and offered many ways to shoot myself in the foot. So just now I did. Shoot myself in the foot, I mean.
I'd copied some mp3s off my other box while being root -- I hadn't noticed. So to be able to play them in Amarok I did the following while being root:
chown -R bert *
thinking I was in /home/bert/mp3. I wasn't. I was in /. (no, not the website). It took a while, but now most files (not all of them, so far I can see) are owned by bert. Is there any way to revert this?
RPM should have this information:
$ rpm -qlv gcc |head lrwxrwxrwx 1 root root 4 Sep 9 18:07 /lib64/32 -> /lib lrwxrwxrwx 1 root root 3 Sep 9 18:07 /usr/bin/cc -> gcc -rwxr-xr-x 1 root root 102920 Sep 9 18:07 /usr/bin/gcc -rwxr-xr-x 1 root root 16125 Sep 9 18:05 /usr/bin/gccbug -rwxr-xr-x 1 root root 28304 Sep 9 18:07 /usr/bin/gcov
Ok, this needs to be scripped somehow...
Andreas
The below should do it...for some reason, I don't feel particularly compelled to test this on my system (gulp!)...
AAiieee! Egads, don't do it that way. Learn and use RPM!
First, use rpm --setugid <packagename> then use rpm --setperms
Just do this:
for i in $(rpm -qa); do rpm --setugids $i && rpm --setperms $i; done
Erm...gulp? Well, my script would do the same thing, I think... But it seems the folks who wrote RPM, who are much smarter than me, have already assumed that eventually someone would do what you did. So do it Jon's way. That's better.