匿名身份验证 您所在的位置:网站首页 ftp服务器匿名登录和不匿名登录有什么区别 匿名身份验证

匿名身份验证

2023-09-20 15:46| 来源: 网络整理| 查看: 265

匿名身份验证 项目 07/19/2023

概述

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

匿名身份验证允许用户访问 Web 或 FTP 站点的公共区域,而无需提示他们输入用户名或密码。 默认情况下,IIS 7.0 中引入并取代 IIS 6.0 IUSR_computername帐户的 IUSR 帐户用于允许匿名访问。 应用程序是一组文件,这些文件通过协议(如 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 的默认安装中。

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

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

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

在任务栏上,依次单击“服务器管理器”、“工具”和“Internet Information Services (IIS) 管理器”。

如果你使用的是 Windows 8 或 Windows 8.1:

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

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

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

如果你使用的是 Windows Vista 或 Windows 7:

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

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

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

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

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

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

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

在任务栏上,依次单击“服务器管理器”、“工具”和“Internet Information Services (IIS) 管理器”。

如果你使用的是 Windows 8 或 Windows 8.1:

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

如果使用的是 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 可选的 String 属性。

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

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

username 可选的 String 属性。

指定匿名身份验证的用户名。 如果将此值留空 (即 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 配置这些设置时,必须确保将 commit 参数设置为 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 实验室设备网 版权所有