Wednesday, September 22, 2004

mtree

A real cool command that I had never heard of - mtree. The basic premise is that if you screw up the permissions and/or ownerships of some folder hierarchy, you can easily restore them. This command:

# mtree -p /usr -U /etc/mtree/BSD.usr.dist


will restore the /usr partitition based upon the original distribution.



Another use is mentioned in the man page - to prevernt trojan horses. You can periodically save off new mtree databases, and then compare the tree against its current incarnation. If there are any checksum changes, it will complain.



I'm going to have to look into doing this. It seems like it could be a real butt-saver some times! Those recursive commands, that merrily skip down folder hierarchies, can be very dangerous, esp for someone like me. I know better, but I still do all my work on my server logged in as root - yikes! Looks like a prime candidate to add to one of the periodic lists.


mtree



No comments:

Post a Comment