A scriptable solution to flush Access Control List entries
May 01, '07 07:30:00AM • Contributed by: robg
May 01, '07 07:30:00AM • Contributed by: robg
If you create many access control lists (ACLs), you might want at some point to flush them all. Unfortunately, there's no single command that allows you to remove all the Access Contrll Entries (ACEs) on a file at once, you have to remove them one at a time until there's no more left. There is no elegant solution, but this one-liner will remove all ACEs for you:
until ! { /bin/chmod -a# 0 filename 2> /dev/null; } do echo -n; done
Using the above, you could also create a small script that will recursively remove all the ACEs on a given directory:
#!/bin/bash
for file in $(find $1)
do
until ! { /bin/chmod -a# 0 ${file} 2> /dev/null; } do echo -n; done
done
This hint was emailed to me by Alexandre B. I haven't tested it, as I don't use ACLs. If you do test it, please leave a comment on your experiences.
•
[12,825 views]
