title: C# Creating directory and setting the permissions
body: <p>I am trying to use the code below to allow all users be able to modify a folder:</p>
  
  <pre><code>class Program
  {
      private const string FileName = "test.txt";
      private static readonly string FilePath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\TEST\\" + FileName;
      private static readonly string UserName = Environment.UserDomainName;
  
      static void Main()
      {
          DirectorySecurity securityRules = new DirectorySecurity();
  
          string dirPath = Path.GetDirectoryName(FilePath);
  
          securityRules.AddAccessRule(new FileSystemAccessRule("Users", FileSystemRights.Modify, AccessControlType.Allow));
  
          if (dirPath == null) throw new InvalidOperationException("Failure to save local security settings");
  
          if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath, securityRules);
  
          File.WriteAllText(FilePath, "Test test!");
      }
  }
  </code></pre>
  
  <p>After I run the code, the Users is added to the folder, but not with any rights assigned. All the read, write, execute etc. all the check boxes are not checked. Except the Special permissions is checked.</p>
  
  <p>How Can I add a folder with all Modify for all users?</p>