Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

C:\
    inetpub
        wwwroot
            MyApp
                JS
                Styles

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?

Thanks

share|improve this question

2 Answers 2

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

 
discard

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.