A files-statement can have several options. We can begin by examining the form of the statement in pseudo-code:
files: classes:: /file-object mode=mode owner=uid-list group=gid-list action=fixall/other-options/warnall links=false/stop/traverse/follow/tidy ignore=pattern include=pattern exclude=pattern filter=filter alias define=classlist elsedefine=classlist checksum=md5 flags=BSD flags syslog=true/on/false/off inform=true/on/false/off
An example would be the following:
any:: /var/spool/printQ mode=0775 r=0 o=daemon g=daemon act=fixdirs
The meaning of these item is sketched out below and becomes clearer on
looking at a number of examples. Note that, each of the options below
can be written in either upper or lower case and abbreviated by any
unique abbreviation.
A file object is interpreted as a directory if you write it in the
following form: `/directory-path/.'. i.e. a trailing dot signifies
a directory. This then becomes the same as the directory
command.
/directory
home
may also be
used. See section home
directive.
mode=modestring
action
option determines what will be done about it. The modestring should
consist of either a three digit octal numbers with `+', `-' or
`=' symbols, or a text string like that used by the command
chmod
. For instance: mode=u=rwx,og+rx
would mean set the
read/write and execute flags for the user (file owner) and add the
read/execute flags for others and group bits. An example of the
numerical form might be -002
which would mean that the
read-for-others flag should either not be set or should be unset,
depending on the action you choose. +2000
would mean that the
setuid flag should be present or set, depending on the action.
+2000,-002
would be a combination of these. The `=' sign
sets to an absolute value, so =755
would set the file mode to
mode 755.
flags=BSD flags
chflags
documentation for this. For
example,
/tmp/flags.01 mode=0600 owner=0 group=0 flags=uappnd,uchg,uunlnk,nodump,opaque,sappnd,schg,sunlnk action=touch
recurse=number/inf
inf
then cfengine opens all subdirectories and files beginning
from the specified filename.See section Recursion.
owner=owner list
root,2,3,sysadm
. In cases where you ask
cfengine to fix the ownership automatically, the owner will be set to
the first owner in the list if and only if it is not one of the named
uids in the list.
group=group list
wheel,2,3,sysadm
. In cases where you ask
cfengine to fix the ownership automatically, the group will be set to
the first group in the list if and only if it is not one of the named
gids in the list.
action=action
warnall warndirs warnplain fixall fixdirs fixplain touch linkchildren create compress alertThe upper line results only in warnings being issued. The actions beginning `fix' prompt cfengine to fix encountered problems without bothering the user. No message is issued unless in verbose mode. The special features on the third line will be explained separately. Alert is like
-print
in the find command, it triggers on the existence
of files which have not been ignored, excluded or filtered. This should
normally be used together filter
, in order to locate files of particular types.
include=wildcard/pattern
exclude=wildcard/pattern
include=
list.
ignore
links=stop/traverse/tidy
-l
command line option) you may give this option the value
true
, or traverse
, or follow
. To specify no
recursion you set the value false
or stop
.
Note that the value set here in the cfengine program always
overrides the value set by the -l
command line option, so you
can protect certain actions from this command line option by specifying
a negative value here. If you specify no value here, the behaviour is
determined by what you specify on the command line.
The value links=tidy
has the same effect as the `-L' command
line option except that here it may be specified per item rather than
globally. Setting this value causes links which point to non-existent
files to be deleted.
If the warn directive is used (for directories, plain files or both)
then only a warning message is issued if the file being tested does not
match the specification given. If the fix directives are used then
cfengine does not issue a warning, it simply fixes the value silently.
Non-existent files are created by the touch
command. A
directory may be touched (created) by writing the filename
/a/b/c/.
with a dot as the last character. (This may also be
achieved with the directories
directive, See section directories.)
define=classlist
checksum=md5
ChecksumDatabase
should be set in control:
to the filename of a database file
which is used to cache checksum values. Note that it is also
possible to use a database file for cfd's remote copying by checksum.
If you use the same file for both purposes you risk losing warnings.
Security warning messages are issued only once and the value in the database is then
changed to the new value of the file automatically i.e. the behaviour is similar to
that of setuid root program detection, @xref{Checksum Databases,Checksum Databases,Checksum Databases,cfengine-Tutorial}.
The default values are mode=+000
, recurse=0
,
action=warnall
and any owner or group is acceptable. The default
for links
is to not traverse links unless the -l
option is
set on the command line.
Go to the first, previous, next, last section, table of contents.