Give specific local Windows user group full control access to a folder and its sub folders (edit)

https://stackoverflow.com/questions/48075130/give-specific-local-windows-user-group-read-access-to-a-folder-and-its-subfolder

https://stackoverflow.com/questions/7334216/iis7-permissions-overview-applicationpoolidentity

https://docs.microsoft.com/en-us/iis/manage/powershell/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-application-pools

https://docs.microsoft.com/en-us/iis/get-started/planning-for-security/understanding-built-in-user-and-group-accounts-in-iis

  • IIS_IUSRS (build-in group in IIS 7.0)
  • IUSR (build-in account in IIS 7.0)
  • IIS AppPool\DefaultAppPool

https://docs.google.com/document/d/1gkN2Dy-sL1cx6T5l1pg9RKK0EHxtUzujSk_j-kpCrYQ

How to give full permission to a folder

using System;
using System.IO;
using System.Security.AccessControl;

namespace Secure
{
internal class Program
{
private static void Main(string[] args)
{
string path = @"D:\Samples\WebService";

DirectoryInfo directoryInfo = new DirectoryInfo(path);
DirectorySecurity directorySecurity = directoryInfo.GetAccessControl();

var groupName_IIS_IUSRS = Environment.MachineName + @"\IIS_IUSRS";
var groupName = @".\IIS_IUSRS";

directorySecurity.AddAccessRule(
new FileSystemAccessRule(groupName,
FileSystemRights.FullControl,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.None,
AccessControlType.Allow));

directoryInfo.SetAccessControl(directorySecurity);

System.Console.WriteLine("Done");
}
}
}