⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mtree.8

📁 早期freebsd实现
💻 8
字号:
.\" Copyright (c) 1989, 1990, 1993.\"	The Regents of the University of California.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"     @(#)mtree.8	8.2 (Berkeley) 12/11/93.\".Dd December 11, 1993.Dt MTREE 8.Os.Sh NAME.Nm mtree.Nd map a directory hierarchy.Sh SYNOPSIS.Nm mtree.Op Fl cderux.Op Fl f Ar spec.Op Fl K Ar keywords.Op Fl k Ar keywords.Op Fl p Ar path.Op Fl s Ar seed.Sh DESCRIPTIONThe utility.Nm mtreecompares 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 specifications, or which aremissing from either the file hierarchy or the specification..PpThe options are as follows:.Bl -tag -width flag.It Fl cPrint a specification for the file hierarchy to the standard output..It Fl dIgnore everything except directory type files..It Fl eDon't complain about files that are in the file hierarchy, but not in thespecification..It Fl fRead the specification from.Ar file  ,instead of from the standard input..It Fl KAdd the specified (whitespace or comma separated) keywords to the currentset of keywords..It Fl kUse the ``type'' keyword plus the specified (whitespace or comma separated)keywords instead of the current set of keywords..It Fl pUse the file hierarchy rooted in.Ar path  ,instead of the current directory..It Fl rRemove any files in the file hierarchy that are not described in thespecification..It Fl sDisplay a single checksum to the standard error output that represents allof the files for which the keyword.Cm cksumwas specified.The checksum is seeded with the specified value..It Fl uModify 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..It Fl xDon't descend below mount points in the file hierarchy..El.PpSpecifications are mostly composed of ``keywords'', i.e. strings thatthat specify values relating to files.No keywords have default values, and if a keyword has no value set, nochecks based on it are performed..PpCurrently supported keywords are as follows:.Bl -tag -width Cm.It Cm cksumThe checksum of the file using the default algorithm specified bythe.Xr cksum 1utility..It Cm ignoreIgnore any file hierarchy below this file..It Cm gidThe file group as a numeric value..It Cm gnameThe file group as a symbolic name..It Cm modeThe current file's permissions as a numeric (octal) or symbolicvalue..It Cm nlinkThe number of hard links the file is expected to have..It Cm uidThe file owner as a numeric value..It Cm unameThe file group as a symbolic name..It Cm sizeThe size, in bytes, of the file..It Cm linkThe file the symbolic link is expected to reference..It Cm timeThe last modification time of the file..It Cm typeThe type of the file; may be set to any one of the following:.sp.Bl -tag -width Cm -compact.It Cm blockblock special device.It Cm charcharacter special device.It Cm dirdirectory.It Cm fifofifo.It Cm fileregular file.It Cm linksymbolic link.It Cm socketsocket.El.El.PpThe default set of keywords are.Cm gid ,.Cm mode ,.Cm nlink ,.Cm size ,.Cm slink ,.Cm time ,and.Cm uid ..PpThere are four types of lines in a specification..PpThe 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..PpThe second type of line unsets keywords and consists of the string``/unset'', followed by whitespace, followed by one or more keywords,separated by whitespace..PpThe 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 matchingcharacters (``['', ``]'', ``?'' or ``*''), in which case filesin the hierarchy will be associated with the first pattern thatthey match..PpEach 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..PpAll 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.Dq Nm \&..causes the current directorypath to ascend one level..PpEmpty lines and lines whose first non-whitespace character is a hashmark (``#'') are ignored..PpThe.Nm mtreeutility exits with a status of 0 on success, 1 if any error occurred,and 2 if the file hierarchy did not match the specification..Sh EXAMPLESTo detect system binaries that have been ``trojan horsed'', it is recommendedthat.Nm mtreebe run on the file systems, and a copy of the results stored on a differentmachine, or, at least, in encrypted form.The seed for the.Fl soption should not be an obvious value and the final checksum should not bestored on-line under any circumstances!Then, periodically,.Nm mtreeshould be run against the on-line specifications and the final checksumcompared with the previous value.While it is possible for the bad guys to change the on-line specificationsto conform to their modified binaries, it shouldn't be possible for themto make it produce the same final checksum value.If the final checksum value changes, the off-line copies of the specificationcan be used to detect which of the binaries have actually been modified..PpThe.Fl dand.Fl uoptions can be used in combination to create directory hierarchiesfor distributions and other such things..Sh FILES.Bl -tag -width /etc/mtree -compact.It Pa /etc/mtreesystem specification directory.El.Sh SEE ALSO.Xr chmod 1 ,.Xr chown 1 ,.Xr chgrp 1 ,.Xr cksum 1 ,.Xr stat 2 ,.Xr fts 3 ,.Sh HISTORYThe.Nm mtreeutility appeared in.Bx 4.3 Reno .

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -