There was a script someone wrote in
another question: find / -type d
-printf "chmod %m %p \n" > reset_perms.sh that forced the
permissions down. I'd like to compare
and output the changes rather than
force them down.
Instead of printing out the commands to run change permissions, simply adjust the printf to spit out the uid, gid, mode, and fullpath and send the output to a file. Then as womble mentioned, use diff to compare the two files.
$find / -printf "%U, %G, %m, %p\n" > permissions.txt
0, 0, 755, /bin
0, 0, 755, /bin/chgrp
0, 0, 755, /bin/tar
0, 0, 755, /bin/dir
0, 0, 777, /bin/sh
0, 0, 777, /bin/pidof
0, 0, 777, /bin/bzless
0, 0, 755, /bin/zgrep
...
The command df(1)
takes one or more arguments and will return the mountpoint and device on which that file or directory exists, as well as usage information. You can then use the path or device to look up the filesystem type in the output of mount -v
or similar.
Unfortunately, the output format of both df
and mount
are system-dependent; there is no apparent standard, at least as I can see between Solaris, NetBSD and Mac OS X.
Best Answer
You can compare files remotely using ssh:
Or use sshfs/nfs.