I have C# code (at the end) which:

  1. Creates a file
  2. Prints the current ACL
  3. Gives the builtin users group "write permissions" to the previously created file
  4. Prints the current modified ACL

The write permissions are successfully assigned via code as you can see in the console ouput.

enter image description here

My question is: Why does the security tab of the file, not reflect this permission change for the Users group ?

enter image description here

C# code:

var file = "sectest.txt";
File.WriteAllText(file, "File security test.");
var sid = new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null);

string strBuiltInUsersAccount = sid.Translate(typeof(NTAccount)).ToString();
FileSecurity fileSecurity = new FileSecurity(file,
AccessControlSections.Owner |
AccessControlSections.Group |

Console.WriteLine("AFTER CREATE:");

ShowSecurity(fileSecurity); // BUILTIN\Users group doesn't have Write permission

// short: give "builtin\users" write permissions
var fsAccessRule = new FileSystemAccessRule(strBuiltInUsersAccount,

fileSecurity.ModifyAccessRule(AccessControlModification.Add, fsAccessRule, out bool modified);


Console.WriteLine("AFTER MODIFY:");
ShowSecurity(fileSecurity); // BUILTIN\Users has Write permission

1 Answer 1


That only modifies the single access rule in the ACE. It would then need to be persisted to the file. See File.SetAccessControl(filePath, fileSecurity)



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .