"Error Applying Security - Access is denied" while changing file permissions on windows server 2008
I'm an administrator on a Windows 2008 server. When I try to change file permissions on a directory, I get an error:
Error Applying Security
Access is denied.
I am an administrator on the machine, and I made sure nothing has the file(s) locked (with Process Explorer). I even booted another user who had a logged-in Remote Desktop session.
Some of the files it complains about are in a .hg
folder, as there is a Mercurial repository in the directory I'm working on.
I noticed that something in the directory is set to read-only so I unchecked that and applied. It looked like it worked, but looking again it's back to read-only and setting permissions still fails.
There is a site in IIS using a subdirectory of this directory.
Update:
I just found this article about this sort of problem. The note at the bottom mentions that if it's not working, check out LockHunter. It told me that the directory was locked by IIS, so I ran iisreset -stop
and tried setting permissions again. Same error. :(
This can happen if you really don't have access to that directory. In Windows you CAN lock out the administrator. Ran into this last week, in fact. Check the permissions on that directory to ensure that Administrators is in the list. If you can't even do that, you'll have to take ownership of the folder first (it's a tab in the Advanced Permissions dialog screen).
I resolved this problem by the following steps:
- Open a Command Prompt "As Administrator"
- Run the following commands:
takeown /f G:\folder /r /d y
icacls G:\folder /grant administrators:F /T
REF: http://www.richardawilson.com/2013/12/an-error-occurred-while-applying.html
If anyone else comes across this problem - it happened for me when I wanted to add a service account user to a folder containing thousands of files and the error came up for a lot of them. MDSN says that if you click Continue it still applies the permission on that file. Problem is nobody wants to click it thousands of times.
What worked at the end was changing ownership (Security tab -> Advanced -> Ownership). I changed ownership to a different user than original and applied it to all sub folders. After it finished I changed it back to original owner and again opted to apply to all sub folders.
After you do that the error no longer occurs when applying permissions. Seems like the above procedure resets any errors there are on folders and files.
try again using the default administrator. In Windows 7/Server 2008 there are UAC type restrictions that do not apply to the default administrator. When using other administrative or domain administrative accounts, access denied type errors when applying permissions do often occur. I'm not one to turn the UAC off, we just need learn to operate in a more secure system.
i reached here via google, though very late to the party, but hopefully can help someone.
in my case, the cause is simply because of a funny folder name in a certain parent folder, after i get rid of the special characters, they are all going fine by taking ownership normally via GUI.