Bash – propagate removal of an ACL entry for just one user in Mac OS

access-control-listbashmac-osx

I'm trying to remove an ACL set for johndoe from all the folders recursively on one of my drives without hosing any other entries! Anyone know how to do this without affecting the ACLs that already exist for other groups/users?

I'm looking for the Mac equivalent of "setfacl -d u:johndoe"

I know you can use chmod to remove a rule from multiple files, but the only way I have seen won't work because it removes the rule via its index (eg: the 5th entry of every folder) and the entry for my user won't always be the same index.

Why would you want to do this? Say you inherit an insane file system that has a bunch of individual users instead of groups and you want to get rid of just the individuals since they already have access.

Best Answer

It's a bit long, but you can do something like this:

find . -exec chmod -a "johndoe allow delete,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown,read,write,append,execute,list,search,add_file,add_subdirectory,delete_child" {} \;

You'd also have to run the same command with "deny" to remove any prohibitive rules for the user.

Many thanks to Jesse Rusak on StackOverflow - this was cribbed from his answer.