Changed permissions - printing quit

Herbert Stocker HSH[1126] hell at hell.hsh.stusta.mhn.de
Wed Feb 3 09:04:18 GMT 1999



Hello,


On Tue, 2 Feb 1999 12:59:43 +0100, Jan Kratochvil <short at ucw.cz> wrote  
> 
> > I'm using 1.9.18p10 with FreeBSD 2.2.8.  I have a small network in my
> > office where security is no problem and I decided to deal with a
> > permissions problem in a quick and dirty way -- real quick / real
> > dirty.  I did a "chmod -R 777 /usr".  After this samba quit printing.  I
> 
>   OUCH! You probably broke a lot of things! You lost all the permissions
> like SUID, SGID, sticky and so on... Correct way would be:
> 
> chmod -R ugo+rw 1.sh /usr;chmod ugo+x `find -type d /usr`
> 
>   Probably the only way to get now out from this situation is to reinstall
> the whole system completely. :-))) You'll find probably a lot of different
> things to magically get broken.
> 

If you have another UNIX system, which is installed the same way, this
Perl script will help you to restore the permissions of the files:

#!/usr/bin/perl

open FD, "find /usr \! -type l -print|" or die "executing find: $!";
while(<FD>)
{
  chomp;
  printf "chmod %04o \"%s\"\n", (stat($_))[2] & 07777, $_;
}


You may need to adjust the path to perl in the first line and 
maybee specify the full path to find in the third line.

Pipe it's output to a file and execute this file on the bad system.
This will restore the permissions for all files which exist also on
the good system. Then you can execute the command Jan Kratochvil
suggested.




To get a list of files which are not on the good system, and 
therefore aren't restored, execute

  find /usr -print | sort >/tmp/bad-sys 

on the bad system and

  find /usr -print | sort >/tmp/good-sys

on the good system. Then transfer both files to one host and execute

  diff /tmp/bad-sys /tmp/good-sys | grep '^>' | cut -c 3-




Herbert Stocker



--
  Hell (Herbert Stocker)
      :
mailto:hell at stusta.mhn.de          \_  Hell is also
talkto:hell at hell.hsh.stusta.mhn.de   \_  my  NickName
  goto:D->MUC->StuSta->HSH[1126]       \_  in RealLife
      :








More information about the samba mailing list