How do I change AFS permissions for all subdirectories of a directory (recursively)?
On this page:
Overview
Setting AFS permissions in a directory using "fs sa" will not automatically change the permissions in the subdirectories that already exist in that directory. If you want to change the permissions in all of the subdirectories as well, you have two options:
fsr
The fsr command is in the consult locker, so you must type add consult before running the command for the first time. You need only type the add command once per login session.
The easiest method is to use the "fsr" command in the consult locker. This command is a wrapper around the "fs" command and takes the same arguments, but will change permissions in a given directory and all its subdirectories.
For example, to give joeuser permission to write to your "www" directory, you would normally type:
To set the permissions recursively, you'd simply replace "fs" with "fsr". You will need to have the consult locker "added" already:
joeuser@athena:~$ fsr sa ~/www joeuser write
As is the case any time you change AFS permissions, you should inspect the end result with "fs la" to ensure that the permissions are set as you intended.
find
If you're unable to use "fsr" for some reason, you can use the the "find" command, which traverses a directory structure and finds all the things that match.
If you wanted to give the user permissions in a directory and all its subdirectories, you would do:
Thus, to give joeuser permission to write to every subdirectory of your www directory, you would type:
(In English, that would be "Find everything in the www directory that is of type "d", that is, also a directory, and then execute the following "fs sa" command on it, filling in the directories you've found in place of the {}s")
For more information, please see How do I change permissions in AFS?