[ale] Shoot! I really screwed it up now!

James P. Kinney III jkinney at localnetsolutions.com
Thu Jul 25 17:27:54 EDT 2002


Oops. A typo will prevent the bash script from being useful.

it should be:
rpm -ql --dump $i >> files.txt

need to append to the file or else it will only be the last item.

I'm sure there is a better way to do this in one, don't write to files,
step. But my sed leaves something to be desired.

On Thu, 2002-07-25 at 15:42, James P. Kinney III wrote:
> Let me reiterate my previous  "don't know". There is no "easy, ready to
> run process".
> 
> If you have an RPM based box, you may be in better shape that I
> previously thought. The following stuff will help:
> 
> for i in `rpm -qa` do
> rpm -ql --dump $i > files.txt
> done
> will output a list of all files in rpm --dump format. The files.txt will
> be in the following order:
> 
> path size mtime md5sum mode owner group isconfig isdoc rdev symlink
> 
> according to the rpm database.
> 
> Now some scripting to extract out the owner, group and path to reset the
> permission, and all is well. Except, of course if you have changed
> things since the install. It also will not correct for non-rpm packages.
> 
> #!/usr/bin/perl;
> use strict;
> 
> my ( $dumpfile, $path, $size, $mtime, $md5sum, $mode, $owner, $group,
> @stuff);
> $dumpfile="files.txt";
> open (IN, "<$dumpfile") || die "Failed to open $dumpfile, $!";
> while <IN> {
> ($path, $size, $mtime, $md5sum, $mode, $owner, $group, @stuff)=split
> (/\s/, $_);
> system(chown $owner:$group $path);
> }
> 
> 
> Any improvements offered by Fletch should be immediately incorporated. I
> have not tested this at all. It was merely written in my mail window.
> 
> On Thu, 2002-07-25 at 15:13, James P. Kinney III wrote:
> > This is the time to pull out those excellent backups you've been making.
> > 
> > I don't know of anything that will restore the permissions for an entire
> > drive. You can do it manually as root. 
> > 
> > At this point, the fastest way to recovery may be to do some data
> > backups now (/etc, /home, /usr/local, /opt, /var/www, /var/spool/mail,
> > ...) and then a new install followed by a restore of the backups then
> > manually fix the permissions on the restored stuff.
> > 
> > ouch! That's not as bad as rm. It could be worse. 
> > 
> > On Thu, 2002-07-25 at 14:37, Gary MacKay wrote:
> > > How do I fix the permissions on the entire drive? I was in the root 
> > > directory and wanted to change a couple of .xxx files ownership. I 
> > > issued a "chown root:root .*" command and promptly watched it change the 
> > > entire drive. Why did it do that? At the most id should have done /root/ 
> > > and whatever was under it, not the whole frigging drive!
> > > 
> > > I presume I'm just hosed royally right?
> > > 
> > > - Gary
> > > 
> > > 
> > > ---
> > > This message has been sent through the ALE general discussion list.
> > > See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
> > > sent to listmaster at ale dot org.
> > -- 
> > James P. Kinney III   \Changing the mobile computing world/
> > President and CEO      \          one Linux user         /
> > Local Net Solutions,LLC \           at a time.          /
> > 770-493-8244             \.___________________________./
> > 
> > GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
> > <jkinney at localnetsolutions.com>
> > Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7 
> > 
> > 
> -- 
> James P. Kinney III   \Changing the mobile computing world/
> President and CEO      \          one Linux user         /
> Local Net Solutions,LLC \           at a time.          /
> 770-493-8244             \.___________________________./
> 
> GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
> <jkinney at localnetsolutions.com>
> Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7 
> 
> 
-- 
James P. Kinney III   \Changing the mobile computing world/
President and CEO      \          one Linux user         /
Local Net Solutions,LLC \           at a time.          /
770-493-8244             \.___________________________./

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7 



 This is a digitally signed message part




More information about the Ale mailing list