MAN page from PLD rpm-utils-5.4.15-25.i686.rpm
MTREE
Section: Maintenance Commands (8)
IndexBSD mandoc
NAME
rpmmtree - map a directory hierarchy
SYNOPSIS
rpmmtree[-
cdeilnqrUux][-
f spec][-
K keywords][-
k keywords][-
p path][-
s seed]
DESCRIPTION
The utility
rpmmtreecompares the file hierarchy rooted in the current directory against aspecification read from the standard input.Messages are written to the standard output for any files whosecharacteristics do not match the specification, or which aremissing from either the file hierarchy or the specification.
The options are as follows:
- -c
- Print a specification for the file hierarchy to the standard output.
- -d
- Ignore everything except directory type files.
- -e
- Don't complain about files that are in the file hierarchy, but not in thespecification.
- -f spec
- Read the specification from filespec instead of from the standard input.
- -i
- Indents the output 4 spaces each time a directory level is descended whencreate a specification with the-coption.This does not effect either the /set statements or the comment before eachdirectory.It does however effect the comment before the close of each directory.
- -K keywords
- Add the specified (whitespace or comma separated) keywords to the currentset of keywords.
- -k keywords
- Use the``type''keyword plus the specified (whitespace or comma separated)keywords instead of the current set of keywords.
- -l
- Do ``loose''permissions checks, in which more stringent permissionswill match less stringent ones.For example, a file marked mode 0444 will pass a check for mode 0644.``Loose''checks apply only to read, write and execute permissions -- inparticular, if other bits like the sticky bit or suid/sgid bits areset either in the specification or the file, exact checking will beperformed.This flag may not be set at the same time as the-uor-Uflags.
- -n
- Do not emit pathname comments when creating a specification.Normallya comment is emitted before each directory and before the close of thatdirectory when using the-coption.
- -p path
- Use the file hierarchy rooted inpath instead of the current directory.
- -q
- Quiet mode.Do not complain when a``missing''directory can not be created because it is already exists.This occurs when the directory is a symbolic link.
- -r
- Remove any files in the file hierarchy that are not described in thespecification.
- -s seed
- Display a single checksum to the standard error output that represents allof the files for which the keywordcksumwas specified.The checksum is seeded with the specified value.
- -t
- If a file's timestamp is different from the specification,``touch''it to match the specification (and list as modified).
- -U
- Modify the owner, group, and permissions of existing files to matchthe specification and create any missing directories.User, group, and permissions must all be specified for missing directoriesto be created.Exit with a status of 0 on success, 1 if any error occurred,a mismatch is not considered an error if it was corrected.
- -u
- Same as the-Uoption except a status of 2 is returned if the file hierarchydid not match the specification.
- -x
- Don't descend below mount points in the file hierarchy.
Specifications are mostly composed of``keywords'' (i.e., strings that specify values relating to files).No keywords have default values, and if a keyword has no value set, nochecks based on it are performed.
Currently supported keywords are as follows:
- cksum
- The checksum of the file using the default algorithm specified bythecksum(1)utility.
- flags
- The current file's flags (whitespace or comma separated) in symbolic formas specified bychflags(1).The string``none''may be used to indicate that no flags should be set on the file.
- gid
- The file group as a numeric value.
- gname
- The file group as a symbolic name.
- ignore
- Ignore any file hierarchy below this file.
- md5digest
- The MD5 message digest of the file.
- mode
- The current file's permissions as a numeric (octal) or symbolicvalue.
- nlink
- The number of hard links the file is expected to have.
- nochange
- Do not change the attributes (owner, group, mode, etc) on a file or directory.
- optional
- The file is optional; don't complain about the file if it'snot in the file hierarchy.
- rmd160digest
- The RIPEMD-160 message digest of the file.
- sha1digest
- The SHA-1 message digest of the file.
- uid
- The file owner as a numeric value.
- uname
- The file owner as a symbolic name.
- size
- The size, in bytes, of the file.
- link
- The file the symbolic link is expected to reference.
- time
- The last modification time of the file.
- type
- The type of the file; may be set to any one of the following:
- block
- block special device
- char
- character special device
- dir
- directory
- fifo
- fifo
- file
- regular file
- link
- symbolic link
- socket
- socket
The default set of keywords aregid mode nlink size link time anduid
There are four types of lines in a specification.
The first type of line sets a global value for a keyword, and consists ofthe string``/set''followed by whitespace, followed by sets of keyword/valuepairs, separated by whitespace.Keyword/value pairs consist of a keyword, followed by an equals sign(`=') followed by a value, without whitespace characters.Once a keyword has been set, its value remains unchanged until eitherreset or unset.
The second type of line unsets keywords and consists of the string``/unset'' followed by whitespace, followed by one or more keywords,separated by whitespace.
The third type of line is a file specification and consists of a filename, followed by whitespace, followed by zero or more whitespaceseparated keyword/value pairs.The file name may be preceded by whitespace characters.The file name may contain any of the standard file name matchingcharactersPo ``['' ``]'' ``?'' or``*''Pc ,in which case files in the hierarchy will be associated with the firstpattern that they match.
Each of the keyword/value pairs consist of a keyword, followed by anequals sign, followed by the keyword's value, withoutwhitespace characters.These values override, without changing, the global value of thecorresponding keyword.
All paths are relative.Specifying a directory will cause subsequent files to be searchedfor in that directory hierarchy.Which brings us to the last type of line in a specification: a linecontaining only the string``..''causes the current directorypath to ascend one level.
Empty lines and lines whose first non-whitespace character is a hashmark(`#')are ignored.
Therpmmtreeutility exits with a status of 0 on success, 1 if any error occurred,and 2 if the file hierarchy did not match the specification.A status of 2 is converted to a status of 0 if the-Uoption is used.
EXAMPLES
To detect system binaries that have been``trojan horsed'' it is recommendedthat
rpmmtree-
Ksha1digestbe run on the file systems, and a copy of the results stored on a differentmachine, or, at least, in encrypted form.The output file itself should be digested using the
sha1(1)utility.Then, periodically,
rpmmtreeand
sha1(1)should be run against the on-line specifications.While it is possible for the bad guys to change the on-line specificationsto conform to their modified binaries, it is believed to beimpractical for them to create a modified specification which hasthe same SHA1 digest as the original.
The-dand-uoptions can be used in combination to create directory hierarchiesfor distributions and other such things; the files in/etc/mtreewere used to create almost all directories in a normal binarydistribution.
FILES
- /etc/mtree
- system specification directory
SEE ALSO
chgrp(1),
chmod(1),
cksum(1),
md5(1),
rmd160(1),
sha1(1),
stat(2),
fts(3),
md5(3),
rmd160(3),
sha1(3),
chown(8)
HISTORY
The
mtreeutility appeared inBSD 4.3 Reno The
rpmmtreeport is based on the OpenBSD
mtree-2.7version, using
popt(3)for option processing, and
rpmio(3)for digests and remote transport.
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- EXAMPLES
- FILES
- SEE ALSO
- HISTORY
This document was created byman2html,using the manual pages.