[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [users] NO! chmod strikes!



Joost, your solution was such an elegant thing, that to
ruin my system to learn it was fair enough.

Thank you.

--Original Message-- by joost

On Mon, Jul 09, 2001 at 06:36:08PM +0200, Martin F. Krafft wrote:
> but anyway, a question for all debianers: how do you get the default
> permissions back on the / tree?

If you have a clean host with very similar filesystem contents, try this:
       
  ssh root@okayhost "find / -regex '/\(mnt\|proc\|tmp\)/.*' -prune -or \
      -not -type l -not -type s -printf '%04.4m %u %g %p\n' " \
    | while read mode user group path
    do 
      chown $user.$group $path 
      chmod $mode $path 
    done 

Alternatively, create a huge script like this:

  find / -regex '/\(mnt\|proc\|tmp\)/.*' -prune -or \
    -not -type l -not -type s -printf 'chown %u.%g %p\nchmod %m %p\n' \
    > fixperms.sh

And copy that to the broken machine and run "sh fixperms".

It might not fix all files, unless the two hosts are nearly equal, but
enough to let you find the missing ones to fix by hand.  Maybe /home/*
will need special care.

Cheers,


Joost



Reply to: