[python-win32] Inheritance not applied to objects and containers

Matthew Howle mdhowle at att.net
Wed Dec 1 19:32:39 CET 2010


The permissions are applied to the directory but subdirectories and files within 
the directory aren't inheriting the permissions.  I can manually go the Advanced 
Security Settings for the directory and check "Apply these permissions to 
objects and/or container within this container only" to get the desired result. 

There was the same issue listed in the 
archive http://mail.python.org/pipermail/python-win32/2006-March/004472.html, 
but there was no response.

Any ideas what I'm missing?

Here is the sample code I'm using:

>>> user,domain,type =  win32security.LookupAccountName("","DOMAIN\\username")
>>> sd = 
>>>win32security.GetFileSecurity("C:\\testdir",win32security.DACL_SECURITY_INFORMATION)
>>>
>>> dacl = sd.GetSecurityDescriptorDacl()
>>> dacl.AddAccessAllowedAceEx(win32security.ACL_REVISION_DS,win32security.OBJECT_INHERIT_ACE|win32security.CONTAINER_INHERIT_ACE,win32file.FILE_ALL_ACCESS,user)
>>>
>>> sd.SetSecurityDescriptorDacl(1,dacl,0)
>>> win32security.SetFileSecurity("C:\\testdir",win32security.DACL_SECURITY_INFORMATION,sd)
>>>

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20101201/e048587a/attachment-0001.html>


More information about the python-win32 mailing list