【问题标题】:Powershell Disable Anonymous FTP and Enable AuthenticationPowershell 禁用匿名 FTP 并启用身份验证
【发布时间】:2020-01-22 16:48:29
【问题描述】:

尝试在 PowerShell 中做一些相当简单的事情。在默认 ftp 站点上禁用匿名 FTP 并启用基本身份验证,如下所示:FTP Authentication

这是我正在尝试的:

c:\windows\system32\inetsrv\appcmd unlock config /section:anonymousAuthentication
c:\windows\system32\inetsrv\appcmd unlock config /section:basicAuthentication
Set-WebConfigurationProperty -filter /system.webServer/security/authentication/anonymousAuthentication -name Enabled -value false -PSPath 'IIS:\sites\Default FTP Site\'
Set-WebConfigurationProperty -filter /system.webServer/security/authentication/basicAuthentication -name Enabled -value true -PSPath 'IIS:\sites\Default FTP Site\'

这成功了:

Unlocked section "system.webServer/security/authentication/anonymousAuthentication" at configuration path "MACHINE/WEBROOT/APPHOST".
Unlocked section "system.webServer/security/authentication/basicAuthentication" at configuration path "MACHINE/WEBROOT/APPHOST".

但它对实际的 IIS 配置完全没有影响。我错过了什么?

【问题讨论】:

    标签: powershell iis ftp


    【解决方案1】:

    请试试这个命令行。它将禁用匿名身份验证并启用基本身份验证。请记住以管理员身份运行 powershell。

    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/sites/site[@name='Default FTP Site']/ftpServer/security/authentication/anonymousAuthentication" -name "enabled" -value "False"
    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/sites/site[@name='Default FTP Site']/ftpServer/security/authentication/basicAuthentication" -name "enabled" -value "True"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多