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

Tim Roberts timr at probo.com
Wed Dec 1 19:59:12 CET 2010


Matthew Howle wrote:
> The permissions are applied to the directory but subdirectories and
> files within the directory aren't inheriting the permissions.

You've stumbled across a very nasty little dark corner.

There are several APIs for managing security descriptors, including APIs
like SetFileSecurity, SetSecurityInfo, and SetNamedSecurityInfo.  You
happened to choose SetFileSecurity.  It turns out this is a low-level
API which does not automatically propagate the inherited permissions. 
Your permissions will apply to NEW objects, but it doesn't modify
EXISTING child objects.

You should investigate either SetSecurityInfo or SetNamedSecurityInfo. 
Both of those will do the propagation automatically.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list