为什么在浏览器属性窗口中浏览权限时,以下访问规则会显示为“特殊权限”?我希望它显示为正常的“修改”访问。
var di = new DirectoryInfo(ConfigDirectory);
DirectorySecurity security = di.GetAccessControl();
var rule = new FileSystemAccessRule(domainSid, FileSystemRights.Modify, AccessControlType.Allow);
security.AddAccessRule(rule);
di.SetAccessControl(security);
domainSid =域用户的SID。
答案 0 :(得分:2)
请改用:
var di = new DirectoryInfo(ConfigDirectory);
DirectorySecurity security = di.GetAccessControl();
var rule = new FileSystemAccessRule(domainSid, FileSystemRights.Modify, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow);
security.AddAccessRule(rule);
security.SetAccessRule(rule);
di.SetAccessControl(security);
区别在于使用FileSystemAccessRule
构造函数,它允许您指定继承和对security.SetAccessRule(rule);
的调用