36

My user account on Windows 7 is part of the Administrators group which has a full control permissions on C:\inetpub\wwwroot:

alt text

However, when I try to create a folder in it, I get the "access denied" error. This is fixed by adding my specific user account to the list but that shouldn't be necessary should it?

Gareth
  • 19,080
Borek Bernard
  • 15,019

8 Answers8

27

The thing is though is that UAC can't "elevate" Explorer properly. See following article which explains why this happens and how to fix. I thought this was fixed in Windows 7 but appears as though it isn't, see Windows 7 Access Denied

Mucker
  • 827
14

From Technet:

To help prevent malicious software from silently installing and causing computer-wide infection, Microsoft developed the UAC feature. Unlike previous versions of Windows, when an administrator logs on to a computer running Windows Vista, the user’s full administrator access token is split into two access tokens: a full administrator access token and a standard user access token. During the logon process, authorization and access control components that identify an administrator are removed, resulting in a standard user access token. The standard user access token is then used to start the desktop, the Explorer.exe process. Because all applications inherit their access control data from the initial launch of the desktop, they all run as a standard user as well.

After an administrator logs on, the full administrator access token is not invoked until the user attempts to perform an administrative task.

So any time that you try to use admin credentials, you should be given a UAC prompt to invoke that Admin token, giving you access to make that change. Now if that is not working, you'll want to check your UAC settings.

Most likely, the setting you need to disable is the "User Account Control: Run all administrators in Admin Approval Mode". You can change that behavior by setting the "EnableLUA" key to 0 in the following location:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

That should make admins run as admins all of the time. This is dangerous and I would recommend that you turn this feature back on for day to day use.

Doltknuckle
  • 6,131
4

This is expected behaviour with UAC enabled.

How are you attempting to create the folder? Windows Explorer will generate a UAC prompt, so I'm assuming you're using some other method?

If you are doing it from a command prompt, make sure it is running with elevated privileges.

1

As many have shared, there are all kinds of reasons why this can happen. If you have totally ruled out ownership/permission issues, it's very likely another program is preventing access to the files.

Sometimes it's a program specifically meant to restrict file access, like Folder Lock, but the most common culprit is that you have the files open in some other program, like a text editor (say, Atom in my case), and this program has a lock on the files. And so in a case like that, access is denied even though you are an admin because no user at all can change a file when it is locked by another another app for reading/writing. And so, after closing the program(s), or closing the open files in the program, you should have regular access to the them again.

0

Like MAYUR above, I also tried the mentioned UAC-related fix, but that didn't work for me.

I was unable to create a new folder, or move an existing folder to, some directory in my user account (Users/x/workspace/).

To fix this I:

  • re-enabled UAC at the second-lowest level (which doesn't let programs modify contents without a UAC warning)
  • created a new folder called Users/x/workspace2, and cut-pasted all the contents from workspace to workspace2.
  • Checked that there were no virtual folders remaining in workspace in cygwin.
  • Deleted workspace
  • Renamed workspace2 to workspace
Blake
  • 121
0

I recently had this problem when programming. I could compile once, but after making changes I couldn't compile again and overwrite the program .exe.

Nothing was locking the file, I was admin, and Windows wouldn't even tell me who the owner of the file was.

In my case, my Anti-Malware (MalwareBytes) program was protecting my computer from suspicious behaviour.

After white listing the folder, I regained access to the locked exe.

Sir Adelaide
  • 4,977
  • 2
  • 16
  • 36
0

In Windows7, administrator account is hidden. You can enable the administrator account.

  1. Click start
  2. Program - Accessories- Right click on command prompt and select " Run as" administrator.
  3. In command prompt type command type net user administrator /active:yes

It will cure it. you will 2 user account one is administrator and your user. Now you can login to windows as administrator. Now you will modify the files or even delete it.

0

I also had the same problem. I have done everything mentioned above but it didn't work. The problem was still on. but now my problem is solved:

  1. Manually open the folder for which the access is denied.
  2. Select the Executable/application file in that folder.
  3. Right click on it and go to PROPERTIES -> COMPATIBILITY
  4. Now see the PRIVILEGE LEVEL and check it for RUN AS ADMINISTRATOR
  5. Then click on CHANGE SETTING FOR ALL USERS.

I guess the problem is solved now.

slm
  • 10,859
MAYUR
  • 1