401 Error after Sharing wwwroot folder on HomeGroup in IIS7, Windows 7

9

5

After sharing my wwwroot folder to the rest of my homegroup, I'm now getting the following error on my website:

Server Error

401 - Unauthorized: Access is denied due to invalid credentials. You do not have permission to view this directory or page using the credentials that you supplied.

My guess is that the folder permissions were mangled when I shared the wwwroot folder. I tried unsharing the folder and restarting IIS7 but I'm still getting the error. Does anyone know the default permissions needed for the wwwroot folder? IIS7 is configured with default settings (i.e., I haven't changed any IIS7 settings).

Any help is greatly appreciated.

Already Tried:

  • Restarting IIS7
  • Turning off and then back on anonymous authentication
  • Unsharing the wwwroot folder

Brian Hasden

Posted 2010-10-11T13:00:53.983

Reputation: 313

Have you granted permissions for the ASP.net account to access that folder ? – Sathyajith Bhat – 2010-10-11T15:41:09.310

The IUSRS group has access to the folder. – Brian Hasden – 2010-10-11T15:43:04.893

Answers

12

In order to reset the wwwroot permissions I went to another box and copied all the settings to the web server having issues.

Here's the steps to return to the default permissions for the wwwroot folder:

  1. right-click on the wwwroot folder and click Properties
  2. go to the Security tab and click the Advanced button
  3. click the "Change Permissions..." button and make check the "Include inheritable permissions from this object's parent" checkbox
  4. remove all permission entries where the "Inherited From" column has a value of "<not inherited>"
  5. click Apply and verify that the following 5 permission entries are being inherited from the "C:\inetpub\" directory:
    • TrustedInstaller - Full control
    • SYSTEM - Full control
    • Administrators - Full control
    • Users - Read & execute
    • CREATOR OWNER - Special

Once those permissions are verified, click the Add button and enter "IIS_IUSRS" for the object name and click OK. Select "Traverse folder / execute file", "List folder / read data", "Read attributes", "Read extended attributes", and "Read permissions" from the permissions list and click OK.

The wwwroot folder should now be set back to the out of the box permissions that come with IIS7.

This fixed the mentioned 401 Access Denied error I was encountering.

Brian Hasden

Posted 2010-10-11T13:00:53.983

Reputation: 313

This worked for me on IIS 7.5, although I didn't need to worry about adding any permissions back in, I just removed all the <not inherited> entries. – DigitalDan – 2016-03-16T16:01:36.623

7

I ran into this same issue. Rather than re-create all permissions though, just had to re-add WEBSERVER\Users with read permissions - it seems that sharing the folder maybe removed that one?

Jason

Posted 2010-10-11T13:00:53.983

Reputation: 71

1I had the same issue. Any idea why it gets removed when sharing a folder? – MrVimes – 2013-05-22T10:53:35.670

0

Thank you everyone for posting this information. Love Microsoft for this one. For us this was caused by sharing the wwwroot directory. Here's what we did to fix it.

  1. Right-Click wwwRoot.
  2. Click Security tab.
  3. Click Advanced Button.
  4. All the permissions mentioned in the post above were there, but they all had "none" in the inherited from column.
  5. Click Enable inheritance.
  6. Click Apply.
  7. Error Message about "Error Applying Security" to the aspnet_client folder. Not sure what this means.
  8. Click Continue.
  9. Wait for the system to apply all of the permissions.
  10. Done.

tommo123456

Posted 2010-10-11T13:00:53.983

Reputation: 1