问题
How can I disable inheritance on a folder and delete all inherited permissions
Thank you
I tried this :
DirectoryInfo dInfo = new DirectoryInfo(path);
DirectorySecurity dSecurity = dInfo.GetAccessControl();
dSecurity.SetAccessRuleProtection(false, false);
回答1:
If someone search the solution :
DirectorySecurity directorySecurity = Directory.GetAccessControl(path);
directorySecurity.SetAccessRuleProtection(true, keepPermissions);
Directory.SetAccessControl(path, directorySecurity);
with keepPermissions true if you want to keep inherited permissions.
来源:https://stackoverflow.com/questions/34162619/disable-inheritance-on-a-folder-ntfs-permissions-in-c-sharp