how to set for everyone all permissed in shared folder
This is my code to set access rules for folder -
FileSystemSecurity fs = File.GetAccessControl(FilePath);
fs.AddAccessRule(new FileSystem开发者_如何学CAccessRule("everyone",
FileSystemRights.FullControl, AccessControlType.Allow));
File.SetAccessControl(FilePath, fs);
"Everyone" gets only read Permission
Why are you Deny
ing permissions if you want to give permissions? If I understand your question you wants to give full control to everyone? If so the following should work:
FileSecurity fSec = File.GetAccessControl(file);
fSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Allow));
File.SetAccessControl(file, fSec);
Edit: Or did you mean that you wanted to make sure that everyone only ever could have read permissions? If so, you'd need to do it the other way around, allow Read
and deny other permissions.
精彩评论