问题
I have a requirement in my application to iterate through all the sub-folders programatically removing "Include inheritable permissions from this object's parent" check box using C#.

And also convert and add the inherited parent permissions as explicit permissions on the folder.
Can any one let me know ? how can i do it in C#.
回答1:
You need to use ObjectSecurity.SetAccessRuleProtection:
string path = @"...";
FileSecurity fs = File.GetAccessControl(path);
fs.SetAccessRuleProtection(true, false);
File.SetAccessControl(path, fs);
来源:https://stackoverflow.com/questions/6574196/programatically-removing-include-inheritable-permissions-from-this-objects-par