So I am trying to modify the permissions for the BUILTIN\Users group to at least have the Modify file system access right. Unfortunately, my attempts at using the below code produce unchanged ACL.
SecurityIdentifier usersSecurityIdentifier = ntAccount.Translate(typeof(SecurityIdentifier)) as SecurityIdentifier;
DirectorySecurity directorySecurity = Directory.GetAccessControl(source.FullName);
FileSystemAccessRule accessRule
= new FileSystemAccessRule(@"BUILTIN\Users", FileSystemRights.FullControl, AccessControlType.Allow);
directorySecurity.ModifyAccessRule(AccessControlModification.Add,
accessRule,
out modified);
Console.WriteLine(modified);
Modified reports true in every case, but the perms are not updated when you look at them on the folder properties.
I have also tried to add an access rule for a SecurityIdentifier that did not not already have an ACL for the directory using similar code but just AddAccessRule instead of modify. Even though the new SecurityIdentifier showed up on the perms list for the directory they did not have the access I specified.
I am attempting to modify access for a proprietary directory in Environment.SpecialFolders.CommonApplicationData that an Administrator account is the owner of. I am also attepting to modify the ACL as an admin.
Does anyone have any idea what's wrong w/ the above code or have any resources that can lead me to the correct way of setting the ACL using native the native .NET classes?