Friday, 29 May 2009

Umbraco directory permissions | umbPermissions Script

It has bugged me since I first used Umbraco that if I was doing a manual installation I had to set the directory permissions

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!

Top 5 most popular posts