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?

8 Answers 8

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.

2
  • I thought UAC might play a role here. So any folder with permissions for the Administrators group will require elevated prompt or a specific username? If so, is there any point in assigning permissions on groups with UAC enabled if I want to be able to access that files/folders from a normal, non-elevated command prompt? May 11, 2010 at 8:40
  • No, with a non-elevated command prompt your user account needs to be explicitly specified in the ACL in order for you to gain access. May 12, 2010 at 7:58
25

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

7
  • 1
    This, I believe is the right answer.. Mar 4, 2013 at 6:29
  • 9
    Please summarize the relevant aspects for my upvote - otherwise we are susceptible to losing the info because the problem will probably be around longer than the website you link to (in windows 7 running on some virtual machine that will outlive us all).
    – sage
    Apr 9, 2013 at 15:58
  • 4
    Downvoting the link-only answer. And I'd -1 twice if I could for that edit begging for upvotes just as a matter of principle. It is ok, nay encouraged, to leave a link to the source of an answer, but as sage stated, without the contents the link may turn useless at some point in the future Jul 9, 2013 at 7:23
  • The linked article states that it is a Explorer bug. It is not. Instead, it is the result of Explorer recycling processes for several windows. You can change the behavior by enabling "Run each window in a separate process".
    – Gogowitsch
    Jun 29, 2014 at 12:55
  • 5
    downvote for link-only answer
    – endolith
    Nov 9, 2015 at 0:34
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.

2
  • 1
    This should be the accepted answer
    – JoelFan
    Apr 26, 2016 at 14:44
  • 1
    Tried to upvote JoelFan, but I double-tapped it and this stupid site won't let me re-upvote! What a crock. But yes, this has everything, including the why and where to go. Just missing that "EnableLUA" needs to be "0" to be disabled, but being power-users here, it's probably understood by most. Other thing, Windows 10 Home doesn't have gpedit and Microsoft touts the "Pro Pack" to install it for $99. There was an installer made for Win7 originally I tried, didn't work, though others on the site claimed it did after copying files from SysWOW64 to System32. So really, regedit was only opt for me.
    – vapcguy
    May 9, 2016 at 23:31
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.

1
  • this was it for me, npm task ran into a problem and I was not aware
    – mohas
    Apr 6, 2019 at 14:03
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.

1
  • 2
    What executable file? The question is about getting access to enumerate folders, not any particular file therein. And you "guess"? yes, clearly. Aug 1, 2015 at 20:49
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
1
  • You need to be careful inside the \users tree on Windows. There are now 'Junctions' in the file system, which are essentially soft links. Some linked folders are only pointers and may behave strangely if treated like folders. If you wipe out part of the tree and create your own structure, you might confuse Windows.
    – trindflo
    Feb 26, 2020 at 22:30
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .