Using `find` to find all directories without group permissions set when ACLs are in use

Viewed 48

I am on CentOS 6.9. I have directories with ACLs enabled. I want to find all the directories that have not set rxw for the group permissions. This is complicated by the fact that ls -l shows the ACL mask in the group permissions spot. If the mask is set to rxw, then find erroneously believes the group permissions are rxw. See the example below :

$ ls -l
total 0
drwx------ 2 user1 somegroup 4096 Aug 10 13:35 stuff

$ find . -type d ! -perm /g+x,g+w,g+r  -print   # Find all directories without rxw set for the group
./stuff

$ setfacl -m u:bob:rwx  stuff/    # Set ACL for new user, mask is calculated. 
$ ls -l                           # Mask displayed in group position
total 0
drwxrwx---+ 2 user1 somegroup 4096 Aug 10 13:35 stuff

$ getfacl stuff/   # Clearly, group permissions are still denied rxw 
# file: stuff/
# owner: user1
# group: somegroup
user::rwx
user:bob:rwx
group::---
mask::rwx
other::---

$ find . -type d ! -perm /g+x,g+w,g+r  -print  # Should print `stuff` here because the group permissions haven't changed, just the ACL mask
$

QUESTION

  1. How do I use find to identify all the directories with the group permissions = 0 (in the octal representation) when ACLs have been set?
0 Answers
Related