2

我使用python添加文件夹的所有允许或全部拒绝权限:

info=win32security.DACL_SECURITY_INFORMATION
sd=win32security.GetFileSecurity(str(path),info)
acl=sd.GetSecurityDescriptorDacl()
systemName=socket.gethostname()
accountName=getpass.getuser()
sidUser=win32security.LookupAccountName(str(systemName),str(accountName))

acl.AddAccessAllowedAceEx(win32security.ACL_REVISION_DS,
win32security.OBJECT_INHERIT_ACE|win32security.CONTAINER_INHERIT_ACE,
win32file.FILE_ALL_ACCESS, sidUser[0])

#acl.AddAccessDeniedAceEx(win32security.ACL_REVISION_DS,
#win32security.OBJECT_INHERIT_ACE|win32security.CONTAINER_INHERIT_ACE,
#win32file.FILE_ALL_ACCESS, sidUser[0])

sd.SetSecurityDescriptorDacl(1, acl, 0)
win32security.SetFileSecurity(str(path), info, sd)

但是当我检查这个文件夹的权限时。拒绝和允许权限均已检查。有什么办法可以改变它,只允许或拒绝检查许可。谢谢

4

0 回答 0