Access denied even though I'm an Administrator?

34

7

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?

Borek Bernard

Posted 2010-05-11T07:50:47.800

Reputation: 11 400

Answers

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.

ThatGraemeGuy

Posted 2010-05-11T07:50:47.800

Reputation: 3 088

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? – Borek Bernard – 2010-05-11T08:40:14.680

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. – ThatGraemeGuy – 2010-05-12T07:58:13.873

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

Mucker

Posted 2010-05-11T07:50:47.800

Reputation: 787

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 – 2014-06-29T12:55:21.280

Such a headache that even administor executing explorer in administrator mode can't have the rights. cmd in administrator mode did the trick. but still rd command give me "access denied" again. For a strange reason, we have to use rd /s /qand then at least it works! – pdem – 2015-09-05T20:30:19.037

3downvote for link-only answer – endolith – 2015-11-09T00:34:00.323

The link also shows some local security policies that could affect the result, via UAC. The thing is, those policies only deal with "behavior of the elevation prompt for administrators in Admin Approval mode", things like that. Is there a hidden prompt that causes an "Access is denied" message because you can't "ok" it, that if you only disabled that prompt/policy, it wouldn't cause it? I'm not buying it. It has to deal with users with admin privileges being treated different than "Administrator". Nothing I've seen allows a user w/admin privileges to do Admin things at a regular cmd prompt. – vapcguy – 2016-05-09T22:10:02.623

1This, I believe is the right answer.. – Chandra Eskay – 2013-03-04T06:29:59.753

9Please 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 – 2013-04-09T15:58:21.983

4Downvoting 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 – Tobias Kienzler – 2013-07-09T07:23:01.080

10

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 modifying the "EnableLUA" key in the following loctaion:

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

Posted 2010-05-11T07:50:47.800

Reputation: 5 813

1This should be the accepted answer – JoelFan – 2016-04-26T14:44:39.133

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 – 2016-05-09T23:31:53.890

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.

Spencer Williams

Posted 2010-05-11T07:50:47.800

Reputation: 161

this was it for me, npm task ran into a problem and I was not aware – mohas – 2019-04-06T14:03:44.827

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

Posted 2010-05-11T07:50:47.800

Reputation: 121

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 – 2020-02-26T22:30:48.210

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

Posted 2010-05-11T07:50:47.800

Reputation: 4 758

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.

dreamerboy

Posted 2010-05-11T07:50:47.800

Reputation: 23

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.

MAYUR

Posted 2010-05-11T07:50:47.800

Reputation: 1

2What executable file? The question is about getting access to enumerate folders, not any particular file therein. And you "guess"? yes, clearly. – underscore_d – 2015-08-01T20:49:43.437