Set Umbraco 7 Folder Permissions

Octopus.Script exported 2015-01-23 by bobjwalker belongs to ‘Umbraco’ category.

To ensure a stable and smoothly running umbraco installation, these permissions need to be set correctly.

These permissions should be set before or during the insallation of umbraco. The user with the permissions set are the user used by the Application Pool used by the IIS website (usually Network Service or the IIS_IUSRS group). If in doubt, ask your server admin / hosting company

Umbraco Wiki Article

Parameters

When steps based on the template are included in a project’s deployment process, the parameters below can be set.

Website Directory

WebsiteDirectory

This is the location where the website is configured to run from in IIS

Application Pool Name

ApplicationPoolName

This is the name of the application pool the website is configured to run under in IIS

Script body

Steps based on this template will execute the following PowerShell script.

$PhysicalPath = "$WebsiteDirectory"
$appPoolAccount = "IIS APPPOOL\$ApplicationPoolName"
$readExecute = $appPoolAccount,"ReadAndExecute","ContainerInherit,ObjectInherit","None","Allow"
$read = $appPoolAccount,"Read","ContainerInherit,ObjectInherit","None","Allow"
$modify = $appPoolAccount,"Modify","ContainerInherit,ObjectInherit","None","Allow"
$fileModify = $appPoolAccount,"Modify","Allow"
$objects = @{}
$objects["App_Browsers"] = $readExecute
$objects["App_Code"] = $modify
$objects["App_Data"] = $modify
$objects["App_Plugins"] = $modify
$objects["bin"] = $modify
$objects["Config"] = $modify
$objects["Css"] = $modify
$objects["MacroScripts"] = $modify
$objects["Masterpages"] = $modify
$objects["Media"] = $modify
$objects["Scripts"] = $modify
$objects["Umbraco"] = $modify
$objects["Umbraco_Client"] = $modify
$objects["UserControls"] = $modify
$objects["Views"] = $modify
$objects["Web.config"] = $fileModify
$objects["Xslt"] = $modify
foreach($object in $objects.Keys){
    try {
        $path = Join-Path $PhysicalPath $object
        $acl = Get-ACL $path
        $rule = New-Object System.Security.AccessControl.FileSystemAccessRule($objects[$object])
        $acl.AddAccessRule($rule)
        Set-Acl $path $acl
        Get-Acl $path | Format-List
    }
    catch [System.Exception]
    {
        Write-Host "Unable to set ACL on" Join-Path $PhysicalPath $object
    }
}

Provided under the Apache License version 2.0.

Report an issue

To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.

{
  "Id": "c60a8c60-c5bc-4dac-9384-65ec4bcf6c67",
  "Name": "Set Umbraco 7 Folder Permissions",
  "Description": "To ensure a stable and smoothly running umbraco installation, these permissions need to be set correctly.\n\nThese permissions should be set before or during the insallation of umbraco. The user with the permissions set are the user used by the Application Pool used by the IIS website (usually Network Service or the IIS_IUSRS group). If in doubt, ask your server admin / hosting company\n\n[Umbraco Wiki Article](http://our.umbraco.org/wiki/reference/files-and-folders/permissions)\n",
  "Version": 3,
  "ExportedAt": "2015-01-23T12:31:26.603+00:00",
  "ActionType": "Octopus.Script",
  "Author": "bobjwalker",
  "Parameters": [
    {
      "Name": "WebsiteDirectory",
      "Label": "Website Directory",
      "HelpText": "This is the location where the website is configured to run from in IIS",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Name": "ApplicationPoolName",
      "Label": "Application Pool Name",
      "HelpText": "This is the name of the application pool the website is configured to run under in IIS",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    }
  ],
  "Properties": {
    "Octopus.Action.Script.ScriptBody": "$PhysicalPath = \"$WebsiteDirectory\"\n$appPoolAccount = \"IIS APPPOOL\\$ApplicationPoolName\"\n$readExecute = $appPoolAccount,\"ReadAndExecute\",\"ContainerInherit,ObjectInherit\",\"None\",\"Allow\"\n$read = $appPoolAccount,\"Read\",\"ContainerInherit,ObjectInherit\",\"None\",\"Allow\"\n$modify = $appPoolAccount,\"Modify\",\"ContainerInherit,ObjectInherit\",\"None\",\"Allow\"\n$fileModify = $appPoolAccount,\"Modify\",\"Allow\"\n$objects = @{}\n$objects[\"App_Browsers\"] = $readExecute\n$objects[\"App_Code\"] = $modify\n$objects[\"App_Data\"] = $modify\n$objects[\"App_Plugins\"] = $modify\n$objects[\"bin\"] = $modify\n$objects[\"Config\"] = $modify\n$objects[\"Css\"] = $modify\n$objects[\"MacroScripts\"] = $modify\n$objects[\"Masterpages\"] = $modify\n$objects[\"Media\"] = $modify\n$objects[\"Scripts\"] = $modify\n$objects[\"Umbraco\"] = $modify\n$objects[\"Umbraco_Client\"] = $modify\n$objects[\"UserControls\"] = $modify\n$objects[\"Views\"] = $modify\n$objects[\"Web.config\"] = $fileModify\n$objects[\"Xslt\"] = $modify\nforeach($object in $objects.Keys){\n    try {\n        $path = Join-Path $PhysicalPath $object\n        $acl = Get-ACL $path\n        $rule = New-Object System.Security.AccessControl.FileSystemAccessRule($objects[$object])\n        $acl.AddAccessRule($rule)\n        Set-Acl $path $acl\n        Get-Acl $path | Format-List\n    }\n    catch [System.Exception]\n    {\n        Write-Host \"Unable to set ACL on\" Join-Path $PhysicalPath $object\n    }\n}",
    "Octopus.Action.Script.Syntax": "PowerShell"
  },
  "Category": "Umbraco",
  "HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/umbraco-v7-folder-permissions.json",
  "Website": "/step-templates/c60a8c60-c5bc-4dac-9384-65ec4bcf6c67",
  "Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADNQTFRF////8m8h+LeQ/NvH9ZNZ83gv/vbx/e3j/eTV+smr9IpL+cCd9pxn+9K596V1+K6D9IE9bvf1pgAABLNJREFUeNrsXd2anDAINb/GqNH3f9q2s9v91m27CYSYSDl3c6NzJEAgQKZJIBAIBAKBQCAQCAQCgUAgEFxgjNEf+PnjeQzCrreo/oK46T08RQzaqgysHl0485ol8UFmnYdloaMCIeoBufgFyOKdy+LHEkZyCgmXxhGL2VQVtjFU31hVDdufSiCg8aLS17v4pMiQOqr96hQh3NprVUVFjNhlfWnVAPp+z2FVE9ibvcruVCO4/U4eh2qI4z6ja1VTWP9Ua9XHegWnmsOFJ6v5vSq/qJuwMOHRmMmNPJoy2dWt2J9sr+6wXXfzaMXER3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PgNe2Izc4TMEic9YKj6DwtiMbuMzTI/PeEM+Ayf5jADlM5SVz5hcPoOL+YyS5jPce2Izbn3iMwCfz5UEE5tLIppYr27XwjC5SGXic7XNxOayoV9gcv3TiwqPC7leXoXHFWlvR4EsLq17EwuLawTfubC42PG36nO4avPDu3C4/PSzcB5/Ha1AIBAIBAKBQCAQCAQCgUDQFj8EGABhylEAPMb2qAAAAABJRU5ErkJggg==",
  "$Meta": {
    "Type": "ActionTemplate"
  }
}

History

Page updated on Friday, January 23, 2015