Proper setup for IIS7.5 machine account for anonymous Web site access - asp.net

Using IIS 7.5, IIS_IUSRS is supposed to be the account to use. I get '401 - Unauthorized: Access is denied due to invalid credentials' error. If I add an EVERYONE account with Read, it works. But rather not have Everyone account. Any idea why IIS_IUSRS does not work? It has Read access. Anonymous Access=enabled. Specific User=IUSR
As a side, on the Basic Settings... for the site, Test Settings button says 'ok-on Authenticate' but Authorization 'cannot verify access to path'.

In IIS 7.5 this has changed from being an IIS_IUSRS account to being a user under the IIS AppPools top level windows group
if you create an application pool called
www.mysite.com
then the sites default created user account that it runs as becomes
IIS AppPools\www.mysite.com
Check the following Microsoft Doc under "Securing Resources" to see more
http://learn.iis.net/page.aspx/624/application-pool-identities/

Under the 'Securing Resources' section listed here:
Open Windows Explorer.
Select a file or directory.
Right click the file and select "Properties"
Select the "Security" tab Click the "Edit" and then "Add" button
Click the "Locations" button and make sure you select your machine. Enter "IIS AppPool\DefaultAppPool" in the "Enter the object names to select:" text box.
Click the "Check Names" button and click "OK".
Substitute DefaultAppPool with the name of the application pool you created/used when adding your site to IIS. This IIS AppPool (not IIS AppPools as of iis 7.5.7600 on Windows 7 pro) group is a group of virtual accounts that you will not see when performing a normal account search on your local machine or via a directory service.

Related

Create an IIS7 user and allow access to directory?

I am running IIS 7 on Windows Server 2003. I am more of an Apache user, so please forgive me.
I need to password-protect a directory on my server to allow only one user to access it via http. A simple 401 challenge is fine.
I've googled this task and they all say to begin double-clicking the "IIS Users" icon in IIS manager. I launched IIS manager via RDP and do not see this icon. (see screenshot)
So how to proceed?
If the user existed, I know how to select the directory and allow access only to that user -- so the question is how to make this user.
You need to create the user under Computer Management and assign the permissions in Windows Explorer. All you would need to do in IIS is make sure you have Windows Authentication turned on, and Anonymous Authentication turned off. So, here's the steps:
Under Control Panel > Administrative Tools > Computer Management. Expand Local Users and Groups > Users > Right Click > New User.
Under Windows Explorer, navigate to the folder you want to secure. Right click on it > Properties > Security Tab > Edit > Add. Give your new user at least Read/Execute permissions to the folder.
Under IIS, expand on your website and select the folder that you want to protect. Then click the Authentication icon. Make sure Windows Auth is on and Anon Auth is off.
That should do it. Your browser should now give you the auth challenge when you try to browse to that folder.

Configure IIS authentication from another domain

I have the following scenario:
I have Web Application hosted on IIS and I am in domain a.b.com. The IIS is configured to authenticate the users with windows authentication and everyone that in the domain a.b.com can enter the site.
But there are users that in another domain lets call it c.d.com and they can't enter the site with their windows credentials because the IIS check against a.b.com...
How can I configure IIS to check for windows user in c.d.com?
Try below process.
Go to (IIS) Manager.
Right Click on Web-Application.
Select Edit Permission option.
Select Security tab.
Click on Edit... button.
Click on Add... button.
Write your new user domain name
Click OK
select newly added User name from Group or user names:
tick on Allow
Click OK
-It should work
You need to set the identity of the application pool of that website:
Open IIS
Under "Application Pools" right click on your website's pool, choose "Advanced Settings..."
Edit "Identity" field
set "Custom account" credentials
Recycle just in case
You application is now using the user you've configured.

IIS7 Permissions Overview - ApplicationPoolIdentity

We have recently upgraded to IIS7 as a core web server and I need an overview in terms of the permissions. Previously, when needing to write to the file system I would have give the AppPool user (Network Service) access to the directory or file.
In IIS7 I see, as default, the AppPool user is set to ApplicationPoolIdentity. So when I check the task-manager, I see that a user account called WebSite.example is running the IIS Process ('Website.example' being the name of the website in IIS)
However this user account doesn't exist if I try to use that to give permissions. So, how do I determine which user to give the permissions too?
See below for the problem in screen shot. Our website (www.silverchip.co.uk) runs on the username SilverChip.co.uk. However when I add permissions, this user doesn't exist!
See AppPool Image:
ApplicationPoolIdentity is actually the best practice to use in IIS7+. It is a dynamically created, unprivileged account. To add file system security for a particular application pool see IIS.net's "Application Pool Identities". The quick version:
If the application pool is named "DefaultAppPool" (just replace this text below if it is named differently)
Open Windows Explorer
Select a file or directory.
Right click the file and select "Properties"
Select the "Security" tab
Click the "Edit" and then "Add" button
Click the "Locations" button and make sure you select the local machine. (Not the Windows domain if the server belongs to one.)
Enter "IIS AppPool\DefaultAppPool" in the "Enter the object names to select:" text box. (Don't forget to change "DefaultAppPool" here to whatever you named your application pool.)
Click the "Check Names" button and click "OK".
Remember to use the server's local name, not the domain name, when resolving the name
IIS AppPool\DefaultAppPool
(just a reminder because this tripped me up for a bit):
Giving access to the IIS AppPool\YourAppPoolName user may be not enough with IIS default configurations.
In my case, I still had the error HTTP Error 401.3 - Unauthorized after adding the AppPool user and it was fixed only after adding permissions to the IUSR user.
This is necessary because, by default, Anonymous access is done using the IUSR. You can set another specific user, the Application Pool or continue using the IUSR, but don't forget to set the appropriate permissions.
Credits to this answer: HTTP Error 401.3 - Unauthorized
On Windows Server 2008(r2) you can't assign an application pool identity to a folder through Properties->Security. You can do it through an admin command prompt using the following though:
icacls "c:\yourdirectory" /t /grant "IIS AppPool\DefaultAppPool":(R)
Part A: Configuring your Application Pool
Suppose the Application Pool is named 'MyPool'
Go to 'Advanced Settings' of the Application Pool from the IIS Manager
Scroll down to 'Identity'. Trying to edit the value will bring up a dialog box. Select 'Built-In account' and under it, select 'ApplicationPoolIdentity'.
A few lines below 'Identity', you should find 'Load User Profile'. This value should be set to 'True'.
Part B: Configuring your website
Website Name: SiteName (just an example)
Physical Path: C:\Whatever (just an example)
Connect as... : Application User (pass-through authentication)
(The above settings can be found in 'Basic Settings' of the site in the IIS Manager)
After configuring the basic settings, look for the 'Authentication' configuration under 'IIS' in the main console of the site. Open it. You should see an option for 'Anonymous Authentication'. Make sure it is enabled. Then right click and 'Edit...' it. Select 'Application Pool Identity'.
Part C: Configuring your folder
The folder in question is C:\Whatever
Go to Properties - Sharing - Advanced Sharing - Permissions, and tick 'Share this folder'
In the same dialog box, you will find a button 'Permissions'. Click it.
A new dialog box will open. Click 'Add'.
A new dialog box 'Select Users or Groups' will open. Under 'From this location' make sure the name is the same as your local host computer. Then, under 'Enter the object names', type 'IIS AppPool\MyPool' and click 'Check Names' and then 'Ok'
Give full sharing permissions for 'MyPool' user. Apply it and close the folder properties
Open folder properties again. This time, go to Security - Advanced - Permission, and click Add. There will be an option 'Select a Principal' at the top, or some other option to choose a user. Click it.
The 'Select Users or Groups' dialog box will open again. Repeat step 4.
Give all or as many permissions you need to the 'MyPool' user.
Check 'Replace all child object permissions..." and Apply and close.
You should now be able to use the browse the website
Top Answer from Jon Adams
Here is how to implement this for the PowerShell folks
$IncommingPath = "F:\WebContent"
$Acl = Get-Acl $IncommingPath
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule("IIS AppPool\DefaultAppPool","FullControl","ContainerInherit, ObjectInherit", "None", "Allow")
$Acl.SetAccessRule($Ar)
Set-Acl $IncommingPath $Acl
Just to add to the confusion, the (Windows Explorer) Effective Permissions dialog doesn't work for these logins.
I have a site "Umbo4" using pass-through authentication, and looked at the user's Effective Permissions in the site root folder.
The Check Names test resolved the name "IIS AppPool\Umbo4", but the Effective Permissions shows that the user had no permissions at all on the folder (all checkboxes unchecked).
I then excluded this user from the folder explicitly, using the Explorer Security tab.
This resulted in the site failing with a HTTP 500.19 error, as expected. The Effective Permissions however looked exactly as before.
I fixed all my asp.net problems simply by creating a new user called IUSER with a password and added it the Network Service and User Groups. Then create all your virtual sites and applications set authentication to IUSER with its password.. set high level file access to include IUSER and BAM it fixed at least 3-4 issues including this one..
Dave

HTTP Error 401.3 - Unauthorized

I am getting this errror in my newly created website in Windows 7 and IIS 7.5. I created an SSL certificate and done binding new website.
HTTP Error 401.3 - Unauthorized
You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.
Earlier when I created the website, I selected 'application user(pass through authentication)' in 'Add Website' dialogue. and when I click "Test Settings ..." button, I get this error message:
The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access. Make sure that the application pool identity has Read access to the physical path. If this server is joined to a domain, and the application pool identity is NetworkService or LocalSystem, verify that \$ has Read access to the physical path. Then test these settings again.
Please suggest solution to this.
Thanks.
I had the same issue, ensured my DefaultAppPool was running under ApplicationPoolIdentity and the DefaultAppPool had permissions to the folder, but some files still didn't load.
Turns out my problem was that the anonymous authentication user was set to someone else instead of ApplicationPoolIdentity
Screenshot
Make sure that application pool of your website and website both are running under the same identity. Then make sure that this identity has required permissions on the virtual directory. I had exact same issue and above two checks fixed it.
IIS 7 also creates "IUSR" as default user to access files via IIS. So make sure user IUSR has read access to files/folders.
How to check if IUSR has read Access? Right Click -> Folder -> Properties -> Security Tab See if IUSR is in Group or user names list, If No.
Click Edit -> Add -> Advanced -> Find Now -> Select IUSR and click OK -->click Apply
The below worked for me. I did not set up an SSL, just a new website within IIS. Upon doing so I was immediately unable to access the website with this error message.
When I created the new website, a new Application Pool was also created. The Identity of this Application Pool was set to ApplicationPoolIdentity. As mentioned by Suhas, the Application Pool of the website and the website itself must be running under the same identity. (I do not know how to check the identity of the website, but the Application Pool's Identity can be checked by going to Application Pools and looking at the Identity column). The default Application Pool name is DefaultAppPool.
I added permissions to the site (right click the site name -> Edit Permissions -> Security -> Edit -> Add), linking the site to the DefaultAppPool object, which in turn gives the site access to the default user and it's settings. (The default user is created when IIS is installed. Read more about this in Microsoft's docs).
I thought this would be all that's needed to obtain access, but this is incorrect. The website's Application Pool must also be set to DefaultAppPool. This can be done by right clicking on the site -> Manage Website -> Advanced Settings -> Change the Application Pool value to DefaultAppPool.

IIS7 folder permissions for web application

I am using windows authentication without impersonation on my company's intranet website with IIS7.
Under IIS7, what account is used to access the folder which contains my web app using these settings?
Would it be IIS_IUSRS? Or NETWORK SERVICE? Or another I don't know about?
In IIS 7 (not IIS 7.5), sites access files and folders based on the account set on the application pool for the site. By default, in IIS7, this account is NETWORK SERVICE.
Specify an Identity for an Application Pool (IIS 7)
In IIS 7.5 (Windows 2008 R2 and Windows 7), the application pools run under the ApplicationPoolIdentity which is created when the application pool starts. If you want to set ACLS for this account, you need to choose IIS AppPool\<yourpoolname> instead of NT Authority\Network Service.
http://forums.iis.net/t/1187650.aspx has the answer. Setting the iis authentication to appliction pool identity will resolve this.
In IIS Authentication, Anonymous Authentication was set to "Specific User". When I changed it to Application Pool, I can access the site.
To set, click on your website in IIS and double-click "Authentication". Right-click on "Anonymous Authentication" and click "Edit..." option. Switch from "Specific User" to "Application pool identity". Now you should be able to set file and folder permissions using the IIS AppPool\{Your App Pool Name}.
If it's any help to anyone, give permission to "IIS_IUSRS" group.
Note that if you can't find "IIS_IUSRS", try prepending it with your server's name, like "MySexyServer\IIS_IUSRS".
Running IIS 7.5, I had luck adding permissions for the local computer user IUSR. The app pool user didn't work.
Worked for me in 30 seconds, short and sweet:
In IIS Manager (run inetmgr)
Go to ApplicationPool -> Advanced Settings
Set ApplicationPoolIdentity to NetworkService
Go to the file, right click properties, go to security, click edit, click add, enter Network Service (with space, then click 'check names'), and give full control (or just whatever permissions you need)
Working on IIS 7.5 and Windows 7 i couldnt give permission
APPPOOL/Mypool
IUSR and IIS_IUSRS permissions not working for me
I got to problem this way:
-Created console application with C#
-This appliaction using createeventsource like this
if(!System.Diagnostics.EventLog.SourceExists(sourceName)) System.Diagnostics.EventLog.CreateEventSource(sourceName,logName);
-Build solution and get .exe file
-Run exe as administator.This create log file.
NOTE: Dont remember Event viewer must be refresh for see the log.
I hope this solution helps someone :)
Read/Write permission for Web host application using IIS follow following step:-
1)Check the Application pool for the Site
2)Go to Application Pool and Check the Identity of the Site.
3)Explorer the Site and go to the main folder and right-click on that folder.
4)Go to Security Tab and click on the Edit button and then click on the user Identity and below you can see the multiple check box options which you want to provide permission for authenticated users after selecting the check box click on save.

Resources