使用posix 1e Python module,我可以获取/设置文件的ACL,而不必生成子进程并调用getfacl / setfacl

>>> import posix1e
>>> acl1 = posix1e.ACL(file="file.txt")
>>> print acl1
user::rw-
group::rw-
other::r--


我还可以应用默认ACL并将其删除:

path = '/some/other/path/'
acl1.applyto(path, posix1e.ACL_TYPE_DEFAULT)
posix1e.delete_default(path)


但是,我似乎无法解决如何检索默认ACL!有谁知道如何使用posix 1e模块来做到这一点?

最佳答案

原来有一种方法可以做到这一点:

default_acl1 = posix1e.ACL(filedef="/some/other/path/")

关于python - 使用Posix 1e检索Python中的默认ACL,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38855666/

10-14 15:44