NFSv4 ACL inheritance will not walk the tree for you
// An inheritable ACE on a directory is not a recursive apply. Existing objects stay put. So do new children of those objects. nfs4_setfacl -R is the unglamorous part.
NFSv4 ACL inheritance will not walk the tree for you
You put an inheritable ACE on the case folder, dusted off your hands, and assumed the files inside got the memo. They did not. The folder did. Everything already in it is still sitting there like you never showed up.
The folder you thought you shared
Engineer gets assigned to an existing case directory. Classic move: slap an inheritable Allow ACE on that directory (fd, file-inherit plus directory-inherit) and walk away. It feels recursive. It is not recursive. It is a sticky note on the door that only applies to people who move in afterwards.
New files created under that directory will pick the ACE up. Everything that already exists will not. I know, I know. You wanted the other thing.
That is RFC 8881 §6.4.3, not ONTAP being difficult. Inheritable ACEs are copied at create time from the immediate parent. Changing the parent later does not rewrite descendants. The protocol is very clear about this. It just isn't the protocol anyone hopes for when a human has been added to a case.
I ran this on ONTAP 9.20.1 with a unix-style volume, NFSv4.1, sec=sys, and Linux nfs4-acl-tools. Confirmation is nfs4_getfacl on every object: whether a jagger@nas.lab ACE is present, in what form, and how many copies. Jagger is our stand-in engineer. Jagger would like to open the files.
Tree, owned by root, chmod -R 750:
case1/
file1
sub1/
file2
sub2/
file3The ACE used throughout:
A:fd:jagger@nas.lab:rwaDxtTnNcCyBaseline, or: nobody invited Jagger yet
No jagger@nas.lab ACE on the parent. None on anything under it. nfs4_getfacl is a sea of nothing. This is the boring screenshot you skip in the ticket, and then later wish you had.
| Object | nfs4_getfacl ACE for jagger@nas.lab | Copies |
|---|---|---|
| case1 | — | 0 |
| case1/file1 | — | 0 |
| case1/sub1 | — | 0 |
| case1/sub1/file2 | — | 0 |
| case1/sub1/sub2 | — | 0 |
| case1/sub1/sub2/file3 | — | 0 |
Zero of six. Ground truth. Take it. You'll want it when someone asks "did it ever work?"
Inherit-only: you tagged the door
nfs4_setfacl -a A:fd:jagger@nas.lab:rwaDxtTnNcCy case1No -R. That is the whole experiment. Then, as root, create three new objects under case1, plus a new file and directory inside the pre-existing sub1:
case1/newfile_top
case1/newdir_top
case1/newdir_top/newfile_nested
case1/sub1/newfile_in_EXISTING_subdir
case1/sub1/newdir_in_EXISTING_subdircase1 itself has the ACE. Congratulations: Jagger can see the folder. New objects created directly under case1 inherit it, because they did not exist when you set the ACE and their parent actually has something to copy.
New files drop fd and D (delete-child). rwaDxtTnNcCy becomes rwaxtTnNcCy. Files do not keep directory-only bits. They are files. They know what they are.
New directories keep fd and D, so grandchildren of those new directories inherit too. The ACE can propagate down a lineage that starts after you set it. It cannot time-travel.
The five objects that already existed still have no jagger@nas.lab ACE. The furniture did not get the sticky note. Only the door did.
| Object | nfs4_getfacl ACE for jagger@nas.lab | Copies |
|---|---|---|
| case1 (parent, ACE set here) | A:fd:jagger@nas.lab:rwaDxtTnNcCy | 1 |
| file1 | — | 0 |
| sub1 | — | 0 |
| file2 | — | 0 |
| sub2 | — | 0 |
| file3 | — | 0 |
| newfile_top | A::jagger@nas.lab:rwaxtTnNcCy | 1 |
| newdir_top | A:fd:jagger@nas.lab:rwaDxtTnNcCy | 1 |
| newfile_nested | A::jagger@nas.lab:rwaxtTnNcCy | 1 |
| newfile in existing sub1 | — | 0 |
| newdir in existing sub1 | — | 0 |
Four of eleven. The ACE on the parent did not walk the tree. It never was going to.
"But what about a new file inside the old subdirectory?"
This is the follow-up. Every time. Fine, existing files stay as they are, but a new file created later inside an old subdirectory should inherit from the folder above, right? Grandparent has fd. Surely the ACE can skip a generation.
No. Inheritance is taken from the immediate parent at create time, not from a grandparent. NFSv4 ACLs are not a trust fund.
After the inherit-only ACE, sub1 still had no jagger@nas.lab ACE. A new file and a new directory created directly inside that existing sub1 also had none, even though case1 above it was sitting there looking inheritable. nfs4_getfacl on those two objects was empty for that principal. Empty.
sub1 is a wall. The ACE on case1 does not have X-ray vision. Put an inheritable ACE on sub1 itself, or walk the tree with nfs4_setfacl -R. Those are the options. Hoping is not one of them.
-R, or: the part you actually needed
nfs4_setfacl -R -a A:fd:jagger@nas.lab:rwaDxtTnNcCy case1Every object then has a jagger@nas.lab ACE. Directories keep A:fd:jagger@nas.lab:rwaDxtTnNcCy. Files store A::jagger@nas.lab:rwaxtTnNcCy even though the command sent fd and D. The server strips what does not belong on a file. It will not argue with you about it. It will just do it.
-a inserts. It does not merge. It does not look at the ACL, notice Jagger is already there, and politely skip ahead. The four objects that already carried the ACE now show two copies. The seven that did not have it show exactly one. Run this twice because you got nervous and Jagger gets a matching set.
| Object after -R -a | Stored ACE for jagger@nas.lab | Copies |
|---|---|---|
| case1 | A:fd:jagger@nas.lab:rwaDxtTnNcCy | 2 |
| newdir_top | A:fd:jagger@nas.lab:rwaDxtTnNcCy | 2 |
| newfile_top | A::jagger@nas.lab:rwaxtTnNcCy | 2 |
| newfile_nested | A::jagger@nas.lab:rwaxtTnNcCy | 2 |
| sub1 | A:fd:jagger@nas.lab:rwaDxtTnNcCy | 1 |
| sub2 | A:fd:jagger@nas.lab:rwaDxtTnNcCy | 1 |
| newdir in existing sub1 | A:fd:jagger@nas.lab:rwaDxtTnNcCy | 1 |
| file1 | A::jagger@nas.lab:rwaxtTnNcCy | 1 |
| file2 | A::jagger@nas.lab:rwaxtTnNcCy | 1 |
| file3 | A::jagger@nas.lab:rwaxtTnNcCy | 1 |
| newfile in existing sub1 | A::jagger@nas.lab:rwaxtTnNcCy | 1 |
Eleven of eleven. Check nfs4_getfacl before repeating -a. A second walk stacks another copy. The command will succeed. That is not the same thing as "this was a good idea."
After that recursive apply, new objects created under the former wall inherit again, because their immediate parent now has an inheritable ACE. Setting fd first, then -R, covers both the stuff that already existed and the stuff that has not been created yet. That is the whole trick. It is not a trick. It is two operations.
What to do, since wishing did not work
Put the inheritable ACE on the top of the tree so later creates inherit. Then walk what already exists with nfs4_setfacl -R. Door plus furniture.
Do not re-run -R -a blindly. Look at nfs4_getfacl first. Remove with -x and add again, or add only where the ACE is missing. -a is append. Treat it that way.
A group ACE applied once, with later assignment done by changing group membership, would avoid re-walking the tree every time someone new shows up. That still needs one recursive apply of the group ACE first. I did not test the membership-change half. I already had my answer, and I was not about to invent a second lab for a hypothesis.
The fine print, because someone will ask
Unix security style, NFSv4 ACLs, ONTAP 9.20. I did not run NTFS-style volumes or SMB inheritance. Different beast, different arguments, different blog post.
ONTAP has no server-side "replace child permissions" for NFSv4. I looked. vserver security file-directory -security-type nfsv4 is not supported. RFC "automatic inheritance" (dacl plus ACL4AUTOINHERIT) is still a client recursive rewrite. The word "automatic" is doing a lot of work in that sentence.
Confirmation is nfs4getfacl. The write bits in the ACE were not exercised. Recursive apply cost on a large tree was not measured; nfs4setfacl -R is a client-side walk over NFS. If your tree is huge, this will take a while. It will still be faster than explaining to Jagger why the folder opens and the files do not.
See RFC 8881 §6.4.3. It said this already. I just ran it so you would believe me.