3

我正在尝试以递归方式从我的一个驱动器上的所有文件夹中删除为 johndoe 设置的 ACL,而无需冲洗任何其他条目!任何人都知道如何在影响其他组/用户已经存在的 ACL 的情况下执行此操作?

我正在寻找相当于“setfacl -du:johndoe”的 Mac

我知道您可以使用 chmod 从多个文件中删除规则,但我看到的唯一方法不起作用,因为它通过其索引删除规则(例如:每个文件夹的第 5 个条目)并且我的用户的条目赢了' 并不总是相同的索引。

你为什么想做这个?假设您继承了一个疯狂的文件系统,该文件系统具有一堆个人用户而不是组,并且您只想摆脱个人,因为他们已经拥有访问权限。

4

3 回答 3

4

How about the chmod "-a" option?

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" {} \;

It will remove all ACL permissions for johndoe on all files recursively from the current directory. (It will print errors for all files without an ACL, but it will still work on the rest of 'em). As you mentioned, you'll have to run this with "inherited" and "deny" as well.

EDIT: Here are tools that use ACLs on Mac OS X:

# cat has_acl.sh 
otool -IV $1 2>&1 | grep _acl_ > /dev/null
# find /bin /sbin /usr/bin /usr/sbin -exec ./has_acl.sh {} \; -print
/bin/chmod
/bin/ls
/usr/bin/ex
/usr/bin/rview
/usr/bin/rvim
/usr/bin/vi
/usr/bin/view
/usr/bin/vim
/usr/bin/vimdiff
/usr/sbin/cupsd
/usr/sbin/kadmind
/usr/sbin/pkgutil

vi only reads & preserves the ACLs, the others don't seem useful, either. But there could be 3rd party tool. Maybe in Fink/MacPorts?

于 2009-03-25T12:28:25.923 回答
0

我将 grep 的输出ls -le作为用户名,然后使用您找到的索引号删除规则awk。只要你不叫你的用户读、写、拒绝、允许、删除等等;)

于 2009-03-12T09:42:49.723 回答
0

find / -print0 -type fd | xargs -0 ls -le | more

可能会帮助您开始探索文件系统。

您可以替换more为另一个命令,例如for ACL 输出,以及处理withgrep结果的后续管道。grepfsaclctl

于 2009-03-12T14:36:33.917 回答