Hello Robert, I don't feel authorized to tell you that everything inside base.tgz is set correctly after untarring (must look inside install script to be 100% sure), but here's a script that I've been using lately. Note Linux' [sS] and OpenBSD's [tT]. Good that there are standards!
Bill ----------------------------------------------------------------------- #!/bin/sh # # findperms - find node permissions # Usage: ./findperms [-r [-t]] node # Writes to stdout # Will print: # type mode owner.group path # type mode owner.group path/tree.. [-r] # type mode owner.group /tree.. [-r -t] os="$(uname)" if [ "X$1" = "X-r" ]; then recursive=yes shift fi if [ "X$1" = "X-t" ]; then truncate=yes shift fi if [ -z "$1" ] || [ -n "$truncate" -a -z "$recursive" ]; then echo "Usage: ./findperms [-r [-t]] node" exit 1 fi node="$1" command="ls -ld $node" if [ "X$recursive" = "Xyes" ]; then command="find $node -exec ls -ld {} \;" fi subst=" " if [ "X$truncate" = "Xyes" ]; then subst=" $node" fi # OpenBSD and Linux use different output formats with 'ls -l' # Merging the two awk commands into one turned out not to be a good idea (maintenance) if [ X"$os" = X"OpenBSD" ]; then eval $command | sed -e 's/, */,/' -e 's/ ->.*//' | grep -v "^total" | awk -F' ' '{ mod=0 } /^.r......../ { mod += 400 } /^..w......./ { mod += 200 } /^...x....../ { mod += 100 } /^...s....../ { mod += 4000 } /^....r...../ { mod += 40 } /^.....w..../ { mod += 20 } /^......x.../ { mod += 10 } /^......s.../ { mod += 2000 } /^.......r../ { mod += 4 } /^........w./ { mod += 2 } /^.........x/ { mod += 1 } /^.........T/ { mod += 1000 } /^.........t/ { mod += 1001 } { printf "%c %04d %s.%s ", substr($1, 1, 1), mod, $3, $4 } { if ($9) print $9; else print $8 }' | sed "[EMAIL PROTECTED]@ @" elif [ X"$os" = X"Linux" ]; then eval $command | sed -e 's/, */,/' -e 's/ ->.*//' | grep -v "^total" | awk -F' ' '{ mod=0 } /^.r......../ { mod += 400 } /^..w......./ { mod += 200 } /^...x....../ { mod += 100 } /^...S....../ { mod += 4000 } /^...s....../ { mod += 4100 } /^....r...../ { mod += 40 } /^.....w..../ { mod += 20 } /^......x.../ { mod += 10 } /^......S.../ { mod += 2000 } /^......s.../ { mod += 2010 } /^.......r../ { mod += 4 } /^........w./ { mod += 2 } /^.........x/ { mod += 1 } /^.........t/ { mod += 1000 } { printf "%c %04d %s.%s ", substr($1, 1, 1), mod, $3, $4 } { if ($9) print $9; else print $8 }' | sed "[EMAIL PROTECTED]@ @" fi exit 0 ----------------------------------------------------------------------- On Mon, 2006-12-04 at 14:18 +0100, Robert Urban wrote: > Hi Misc'ers, > > I did something stupid on my 4.0 server and lost the contents of /bin. > I restored by > booting from the install-cd, mounting /, /usr, and /var, and running > > cd /root-mount; pax -rz -f /cd/4.0/i386/base40.tgz > > (please don't ask what the stupid thing was). > > I saved my /etc, /var/db, /var/www, /var/cron beforehand, so these were > not affected. > > The pax-connaisseurs among you will immediately notice that I forgot to > use "-p e" to > preserve all permissions. I went through manually and reset > setuid/setguid bits for all > relevant files, using a 3.9 system as my guide. > > My question is, does base40.tgz contain the permissions/ownership that > the files should > have after installation? > Is it appropriate to write a script which uses the permissions and > owner/group from base40.tgz to restore the same for all existing files > in the filesystem? > Or do file permissions/ownership somehow get modified during the > installation? > > thanks, > > Rob Urban