[python-win32] Replace all child permissions

Goku Balu tfa.signup.test1 at gmail.com
Mon Mar 20 11:13:54 EDT 2017


Hi all,

Is there anyway to do "Replace all child object permissions with
inheritable permissions from this object" programatically using PyWin32. I
found out that this resets the permissions for all the sub-folders and
files deep-down even though the permissions are set separately.

def remove_permission(path):
    sd = win32security.GetFileSecurity(path,
win32security.DACL_SECURITY_INFORMATION)
    dacl = sd.GetSecurityDescriptorDacl()   # instead of dacl =
win32security.ACL()
    win32security.SetNamedSecurityInfo(path, win32security.SE_FILE_OBJECT,
win32security.DACL_SECURITY_INFORMATION |
win32security.UNPROTECTED_DACL_SECURITY_INFORMATION, None, None, dacl, None)

I tried this on a folder. But didn't work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20170320/a7e76c74/attachment.html>


More information about the python-win32 mailing list