匿名身份验证 您所在的位置:网站首页 匿名ftp访问通常的用户名 匿名身份验证

匿名身份验证

#匿名身份验证 | 来源: 网络整理| 查看: 265

匿名身份验证 项目 09/24/2022

概述

该 元素控制 Internet Information Services (IIS) 7 处理来自匿名用户的请求的方式。 可以修改 元素以禁用匿名身份验证,也可以将 Internet Information Services (IIS) 配置为使用自定义用户帐户处理匿名请求。

匿名身份验证允许用户访问 Web 或 FTP 站点的公共区域,而无需提示用户输入用户名和密码。 默认情况下,IIS 7.0 中引入的 IUSR 帐户将替换 IIS 6.0 IUSR_computername 帐户,用于允许匿名访问。 应用程序是一组文件,通过协议(如 HTTP)提供内容或提供服务。 在 IIS 中创建应用程序时,应用程序的路径将成为站点 URL 的一部分。

默认情况下,IIS 7 使用匿名身份验证。 必须为要为其启用其他身份验证方法(如基本或Windows 身份验证)的任何网站、Web 应用程序或 Web 服务禁用匿名身份验证。

兼容性 版本 备注 IIS 10.0 未 在 IIS 10.0 中修改该元素。 IIS 8.5 未 在 IIS 8.5 中修改该元素。 IIS 8.0 未 在 IIS 8.0 中修改该元素。 IIS 7.5 该 元素未在 IIS 7.5 中修改。 IIS 7.0 该 元素是在 IIS 7.0 中引入的。 IIS 6.0 该 元素替换 IIS 6.0 AuthFlags、 AnonymousUserName 和 AnonymousUserPassword 元数据库属性。

设置

该 元素包含在 IIS 7 的默认安装中。

操作方式 如何禁用匿名身份验证

打开 Internet Information Services (IIS) 管理器:

如果使用 Windows Server 2012 或 Windows Server 2012 R2:

在任务栏上,单击服务器管理器,单击“工具”,然后单击“Internet Information Services” (IIS) 管理器。

如果使用Windows 8或Windows 8.1:

按住 Windows 键,按字母 X,然后单击控制面板。 单击 “管理工具”,然后双击“ Internet Information Services” (IIS) Manager。

如果使用 Windows Server 2008 或 Windows Server 2008 R2:

在任务栏上,单击“ 开始”,指向 “管理工具”,然后单击“ Internet Information Services” (IIS) 管理器。

如果使用 Windows Vista 或 Windows 7:

在任务栏上,单击“开始”,然后单击控制面板。 双击 “管理工具”,然后双击“ Internet Information Services” (IIS) 管理器。

在 “连接” 窗格中,展开服务器名称、展开 “站点”,然后转到要配置的层次结构窗格中的级别,然后单击“网站”或“Web 应用程序”。

滚动到“主页”窗格中的“安全”部分,然后双击“身份验证”。

在“身份验证”窗格中,选择“匿名身份验证”,然后单击“操作”窗格中的“禁用”。

如何从 IUSR 帐户更改匿名身份验证凭据

打开 Internet Information Services (IIS) 管理器:

如果使用 Windows Server 2012 或 Windows Server 2012 R2:

在任务栏上,单击服务器管理器,单击“工具”,然后单击“Internet Information Services” (IIS) 管理器。

如果使用Windows 8或Windows 8.1:

按住 Windows 键,按字母 X,然后单击控制面板。 单击 “管理工具”,然后双击“ Internet Information Services” (IIS) Manager。

如果使用 Windows Server 2008 或 Windows Server 2008 R2:

在任务栏上,单击“ 开始”,指向 “管理工具”,然后单击“ Internet Information Services” (IIS) 管理器。

如果使用 Windows Vista 或 Windows 7:

在任务栏上,单击“开始”,然后单击控制面板。 双击 “管理工具”,然后双击“ Internet Information Services” (IIS) 管理器。

在 “连接” 窗格中,展开服务器名称、展开 “站点”,然后导航到要配置的层次结构窗格中的级别,然后单击网站或 Web 应用程序。

滚动到“主页”窗格中的“安全”部分,然后双击“身份验证”。

在“身份验证”窗格中,选择“匿名身份验证”,然后在“操作”窗格中单击“编辑...”。

在“ 编辑匿名身份验证凭据 ”对话框中,执行下列操作之一:

选择 应用程序池标识 以使用为应用程序池设置的标识,然后单击“ 确定”。

单击 “设置...”,然后在“ 设置凭据 ”对话框中,在“ 用户名 ”框中输入帐户的用户名,在 “密码 ”和“ 确认密码 ”框中输入帐户的密码,单击“ 确定”,然后单击“ 确定 ”。

注意

如果使用此过程,则仅授予 IIS 服务器计算机上的新帐户最低权限。

配置

元素 可在Web.config文件中的站点和应用程序级别进行配置。

属性 特性 说明 enabled 可选布尔属性。

指定是否启用匿名身份验证。

默认值为 true。

logonMethod 可选枚举属性。

logonMethod 属性可以是下列可能值之一。 默认为 ClearText。

值 说明 Batch 此登录类型适用于批处理服务器,进程可能代表用户执行,而无需该用户的直接干预。

数值为 1.

ClearText 此登录类型在身份验证包中保留名称和密码,这样服务器就可以在模拟客户端时连接到其他网络服务器。

数值为 3.

Interactive 此登录类型适用于将以交互方式使用计算机的用户。

数值为 0.

Network 此登录类型适用于高性能服务器,用于对纯文本密码进行身份验证。 不会为此登录类型缓存凭据。

数值为 2.

password 可选字符串属性。

指定匿名身份验证的密码。

注意: 为了避免在配置文件中存储未加密的密码字符串,请始终使用AppCmd.exe或 IIS 管理器输入密码。 如果使用这些管理工具,密码字符串将在写入 XML 配置文件之前自动加密。 这比存储未加密的密码提供更好的密码安全性。

username 可选字符串属性。

指定匿名身份验证的用户名。 如果将此值留空 (即 username=“”) ,匿名身份验证将使用应用程序池标识对匿名用户进行身份验证。

默认值为 IUSR。

子元素

无。

配置示例

以下配置示例为 IIS 7 网站或 Web 应用程序配置匿名身份验证,以便在 Web 服务器上使用本地帐户。 (IIS 7 自动使用 AES 加密来加密密码。)

代码示例

以下示例启用匿名身份验证,并将用于匿名身份验证的默认用户名和密码更改为名为 IUSR 的帐户和 P@ssw0rd的密码。

AppCmd.exe appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:"True" /commit:apphost appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/anonymousAuthentication /userName:"IUSR" /commit:apphost appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/anonymousAuthentication /password:"P@ssw0rd" /commit:apphost

注意

在使用AppCmd.exe配置这些设置时,必须确保将 提交 参数 apphost 设置为该参数。 这会将配置设置提交到ApplicationHost.config文件中的相应位置部分。

C# using System; using System.Text; using Microsoft.Web.Administration; internal static class Sample { private static void Main() { using (ServerManager serverManager = new ServerManager()) { Configuration config = serverManager.GetApplicationHostConfiguration(); ConfigurationSection anonymousAuthenticationSection = config.GetSection("system.webServer/security/authentication/anonymousAuthentication", "Contoso"); anonymousAuthenticationSection["enabled"] = true; anonymousAuthenticationSection["userName"] = @"IUSR"; anonymousAuthenticationSection["password"] = @"P@ssw0rd"; serverManager.CommitChanges(); } } } VB.NET Imports System Imports System.Text Imports Microsoft.Web.Administration Module Sample Sub Main() Dim serverManager As ServerManager = New ServerManager Dim config As Configuration = serverManager.GetApplicationHostConfiguration Dim anonymousAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/anonymousAuthentication", "Contoso") anonymousAuthenticationSection("enabled") = True anonymousAuthenticationSection("userName") = "IUSR" anonymousAuthenticationSection("password") = "P@ssw0rd" serverManager.CommitChanges() End Sub End Module JavaScript var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager'); adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"; var anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso"); anonymousAuthenticationSection.Properties.Item("enabled").Value = true; anonymousAuthenticationSection.Properties.Item("userName").Value = "IUSR"; anonymousAuthenticationSection.Properties.Item("password").Value = "P@ssw0rd"; adminManager.CommitChanges(); VBScript Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager") adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST" Set anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso") anonymousAuthenticationSection.Properties.Item("enabled").Value = True anonymousAuthenticationSection.Properties.Item("userName").Value = "IUSR" anonymousAuthenticationSection.Properties.Item("password").Value = "P@ssw0rd" adminManager.CommitChanges()


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有