I just downloaded a backup of one of my clients Umbraco sites and I was setting up a copy locally and of course I had to set the directory permissions, so I thought there must be a better way!
I did a bit of Googling and had a look on the Umbraco forum but I could not find a script to perform this task, then I came across Set ACL on Source Forge and I set about writing my own little script.
Save the following script as umbpermissions.bat and save it in the same directory as Set ACL
echo off
REM Script to setup the Security Permissions for an Umbraco site
REM This script will give your machine Network Service full rights to the appropriate directories
REM **** Pre-requisites ****
REM You will need to download -> http://setacl.sourceforge.net/
REM **** Usage ****
REM You need to pass in the path for the root of your Umbraco directory
REM E.g. umbPermissions.bat C:\inetpub\umbracoroot
@echo umbPermissions.bat - Script to set Umbraco File and Directory Permissions
@echo Published by Chris Houston - 29th May 2009
@echo http://blog.vizioz.com
SetACL.exe -on "%1\web.config" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\bin" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\config" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\css" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\data" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\masterpages" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\scripts" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\umbraco" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\umbraco_client" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\usercontrols" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
SetACL.exe -on "%1\xslt" -ot file -actn ace -ace "n:%computername%\NETWORK SERVICE;p:full"
Feel free to comment if I missed anything!
that's fantastic - thank you very much - been meaning to write something like this for the last couple of weeks and it's great to just take it from here! thanks again
ReplyDeletethis is absolutely beautiful!
ReplyDeletewe love this! (:
i'm going to add a link in our blog on setting up Umbraco to point towards this post!
thanks again! you're a super star!
lau
There is also a similar guide on our.umbraco.org wiki: http://our.umbraco.org/wiki/install-and-setup/set-umbraco-folder-permissions-from-command-line
ReplyDeleteAlso, IIS 7+ doesn't use the NETWORK SERVICE account by default when creating a new website. (see the aforementioned guide)