Access Keys:
Skip to content (Access Key - 0)

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:

joeuser@athena:~$ fs sa ~/www joeuser write

  

To set the permissions recursively, you'd simply replace "fs" with "fsr". You will need to have the consult locker "added" already:

joeuser@athena:~$ add consult
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:

joeuser@athena:~$ find dirname -type d -exec fs sa {} username permission \;

  
Note: Be sure to fill in the correct information for dirname and username and permission.

Thus, to give joeuser permission to write to every subdirectory of your www directory, you would type:

joeuser@athena:~$ find ~/www -type d -exec fs sa {} joeuser write \;

  

(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?

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

December 09, 2014

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
olc-afs olc-afs Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki