15

How can I find all files with some extended ACLs set, i.e. those with a little + at the end of the permission flags shown by ls -l.

I could not find a corresponding flag for find. My naive approach would be a find combined with ls -l and a grep. But I don't think this is nice.

Does someone have an idea?

15

getfacl can dump ACLs recursively, and it has a --skip-base option for ignoring files without ACLs.

getfacl -R -s -p /directory | sed -n 's/^# file: //p'
| improve this answer | |
0

I found this googling the opposite; to find files with no ACLs set. This is what I ended up with (in case some other googler finds it)

ls --color=auto -lR | grep -v "\+ " | grep -v "^[.,a-z,1-9]" | grep -v "^$"

Apparently ls -R is faster than find (I have a kagillion files and each find command is taking me 2 hours).

| improve this answer | |
0

Perl version:

getfacl -R -p -s  / | perl -wn -e ' if (/^# file/) { s|^# file: /||; print; }'
| improve this answer | |
0

-R: List the ACLs of all files and directories recursively.

-s: Skip files that only have the base ACL entries (owner, group, others).

getfacl -Rs .
getfacl --recursive --skip-base .
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.