(Recursively apply AFS fs commands)


fsr [-hMmVv] fs-command fs-options


fsr wraps the basic AFS fs command to make it recursive. It only works with the fs subcommands that act on directories, namely cleanacl, copyacl, listacl, listquota, lsmount, setacl, setquota, and whereis. All aliases for those commands are also supported.

To apply an fs command recursively, just run fsr instead of fs, leaving all of the other options and command ordering the same, with one exception: all of the directory arguments must actually be directories. Some fs commands will take files as arguments and operate on the directory containing that file, but fsr will warn about and skip any arguments that are not directories. To use any of the options specific to fsr, give them immediately after fsr on the command line and before the fs subcommand.

Note that for copyacl only the target directory will be recursive. In other words, fsr will let you copy the ACLs from a single directory to every directory in a target tree, but won't let you copy ACLs from one directory hierarchy to another matching hierarchy. To copy a tree of files including ACLs, consider the up command (which may be installed on your system as afs-up).

Run fs help for more usage information for fs.


-h, --help

Print out this documentation (which is done simply by feeding the script to perldoc -t) and then exit.

-m, --cross-mounts

Enable crossing of mountpoints. Be very careful with this option, since when using it, fsr will happily recurse into arbitrarily deep file systems. No check is made for whether a given volume had already been visited, so recursive volume structures will cause fsr to descend indefinitely deep. Only use this option if you know the structure of the directory tree you're using it on.

-M, --no-mounts

Normally, fsr will recurse into all directories specified on the command line, regardless of whether those directories are mount points or not. Only mount points underneath those directories won't be crossed (in the absence of the -m option). With this option, any directories specified on the command line that are actually mount points will also be skipped.

-V, --verbose

Print out each directory that fsr acts on as it does so.

-v, --version

Print the version of fsr and exit.


fsr loads configuration settings from /etc/afs-admin-tools/config if that file exists. If it exists, it must be Perl code suitable for loading with require. This means that each line of the configuration file should be of the form:

    our $VARIABLE = VALUE;

where $VARIABLE is the configuration variable being set and VALUE is the value to set it to (which should be enclosed in quotes if it's not a number). The file should end with:


so that Perl knows the file was loaded correctly.

The supported configuration variables are:


The full path to the AFS fs utility. If this variable is not set, fsr defaults to looking for fs on the user's PATH.


Give person1 all AFS permissions (rlidwka) on the group directory mygroup and removes all AFS permissions to that directory for person2:

    fsr sa /afs/ir/group/mygroup person1 all person2 none

Gives personX AFS read permissions (rl) recursively to the directories beginning with cs in the current working directory, except for any subdirectories that are actually mount points:

    fsr sa -dir cs* -acl personX read

Same as above, but recursively descends across mountpoints (be very careful with this):

    fsr -m sa -dir cs* -acl personX read

Gives personX AFS read permissions to all directories in the current directory and recursively to non-mount-point directories below them, but skipping any directories in the current directory that are actually mount points:

    fsr -M sa -dir * -acl personX read

If there are files in the current directory that are not directories, this command will warn about and ignore those files.


fsr ignores symlinks.


Written by Russ Allbery <eagle@eyrie.org> and Carol Oliver. Inspired by a script written by Larry Schwimmer.


Copyright 1999, 2004, 2006, 2007, 2008, 2010, 2011 The Board of Trustees of the Leland Stanford Junior University.

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.



This script is part of the afs-admin-tools package. The most recent version is available from the afs-admin-tools web page at <http://www.eyrie.org/~eagle/software/afs-admin-tools/>.

Last spun 2014-08-10 from POD modified 2014-04-14