Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Windows Server 2008 R2 that hosts a website with the following folder structure:


The Application Pool Identity should have write permissions to both JS and Styles folder since we generate these on the fly. So far no problems.

However, when a new version of the application is deployed, these folders are replaced and the permissions go away. Is there a way to keep the permissions in these specific folders to make sure that they don´t lose their permissions when they are replaced?


share|improve this question

When a new folder is created it will inherit the permissions of it's parent. So if you delete the folders JS and Styles and recreate them they will by default have the same (inherited) persmissions as set on the MyApp folder.

Change your deployment solution to either leave those folders and only change their contents or otherwise have the deployment solution recreate them and re-set the permissions explicitly. Once the folders are deleted there is no magic way to get the same permissions back.

It's also questionable if it's a good idea generate JS and CSS on the fly and write it to disk. If you are minifying on the fly you should simply cache the result in memory which doesn't require write permissions on the disk.

share|improve this answer

You can record the ACLs and security settings using icacls.exe which comes with win7 and windows 2008. This records the permissions into a plain text file. You can then reimport the text file using icacls.exe again and it will reset the security back to what it was.

The syntax is a little complex, but it does work.

ICACLS name /save aclfile [/T] [/C] [/L] [/Q]
stores the DACLs for the files and folders that match the name
into aclfile for later use with /restore. Note that SACLs,
owner, or integrity labels are not saved.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.