Change directory permission under windows

Roger Upole rupole at hotmail.com
Wed Nov 8 16:56:24 EST 2006


__schronos__ wrote:
> Hi.
>
>  I would like to add users with full control access to a directory. I
> can do it to a file in the following way:
>
> info=win32security.DACL_SECURITY_INFORMATION
> sd=win32security.GetFileSecurity(DIR, info)
> acl=sd.GetSecurityDescriptorDacl()
> sidUser=win32security.LookupAccountName(None,USER)[0]
> acl.AddAccessAllowedAce(win32file.FILE_ALL_ACCESS, sidUser)
> sd.SetSecurityDescriptorDacl(1, acl, 0)
> win32security.SetFileSecurity(dir, info, sd)
>
> and it work correctly, but if I try to do the same to a directory only
> the "special permission" checkbox is checked and this is not useful to
> me because I need a "full control" so that files under the directory
> can inheritage the directory rigths.
>
> Can anybody help me
>
> Thank's
>
AddAccessAllowedAce doesn't have a parm for inheritance flags.
Try AddAccessAllowedAceEx instead:

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

       Roger



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----



More information about the Python-list mailing list