FTP 사용자 지정 권한 부여 공급자 공급자 <>
개요
요소는 <provider>
FTP 사이트의 사용자 지정 권한 부여 설정을 지정합니다. 이 권한 부여 형식은 사용자 지정 권한 부여 공급자를 사용하여 사용자 액세스의 유효성을 검사합니다.
사용자 지정 권한 부여 공급자를 사용하도록 설정하면 기본 제공 권한 부여 공급자가 사용되지 않으며 구성에 허용 규칙 또는 거부 규칙을 수동으로 추가할 수 없습니다.
호환성
버전 | 참고 |
---|---|
IIS 10.0 | <provider> 요소가 IIS 10.0에서 수정되지 않았습니다. |
IIS 8.5 | <provider> 요소가 IIS 8.5에서 수정되지 않았습니다. |
IIS 8.0 | 요소는 <provider> IIS 8.0에서 도입되었습니다. |
IIS 7.5 | 해당 없음 |
IIS 7.0 | 해당 없음 |
IIS 6.0 | 해당 없음 |
설치 프로그램
FTP 사이트에서 사용자 지정 공급자를 사용하여 FTP 권한 부여를 지원하려면 FTP 확장성을 사용하여 FTP 서비스를 설치해야 합니다.
Windows Server 2012
Windows 로고 키를 누른 다음 서버 관리자 클릭합니다.
서버 관리자관리를 클릭한 다음 역할 및 기능 추가를 클릭합니다.
역할 및 기능 추가 마법사에서 다음을 수행합니다.
- 시작하기 전 페이지에서 다음을 클릭합니다.
- 설치 유형 페이지에서 설치 유형을 선택하고 다음을 클릭합니다.
- 서버 선택 페이지에서 적절한 서버를 선택하고 다음을 클릭합니다.
- 서버 역할 페이지에서 IIS(웹 서버)가 선택되어 있는지 확인하고 확장합니다.
- FTP 서버를 확장한 다음 FTP 서비스 및 FTP 확장성을 모두 선택한 다음 다음을 클릭합니다.
- 기능 페이지에서 다음을 클릭합니다.
- 설치 선택 확인 페이지에서 설치를 클릭합니다.
- Results(결과) 페이지에서 Close(닫기)를 클릭합니다.
Windows 8
- Windows 제어판을 엽니다.
- Windows 제어판 프로그램 및 기능을 엽니다.
- 프로그램 및 기능에서 Windows 기능 켜기/끄기를 클릭합니다.
- Windows 기능 대화 상자에서 인터넷 정보 서비스를 확장한 다음 FTP 서버를 확장합니다.
- FTP 서버에서 FTP 서비스 및 FTP 확장성을 선택한 다음 확인을 클릭합니다.
방법
사용자 지정 공급자를 기반으로 FTP 권한 부여를 구성하는 방법
IIS(인터넷 정보 서비스) 관리자를 엽니다.
Windows Server 2012 이상을 사용하는 경우:
- 작업 표시줄에서 서버 관리자 클릭하고 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 클릭합니다.
Windows 8 이상을 사용하는 경우:
- Windows 키를 누른 채로 문자 X를 누른 다음 제어판 클릭합니다.
- 관리 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
연결 창에서 서버 이름을 선택하고 사이트를 확장한 다음 FTP 사이트를 선택합니다.
홈 창에서 FTP 권한 부여 규칙 기능을 두 번 클릭합니다.
작업 창에서 기능 설정 편집을 클릭합니다.
권한 부여 기능 설정 대화 상자에서 사용자 지정 권한 부여 공급자 선택을 선택하여 사용자 지정 공급자가 FTP 권한 부여를 사용하도록 설정합니다. 연결된 드롭다운 목록에서 사용자 지정 공급자를 선택합니다.
참고
사용자 지정 FTP 권한 부여 공급자를 사용하도록 설정하면 FTP 권한 부여 규칙 기능이 비활성화됩니다.
확인을 클릭합니다.
구성
요소는 <provider>
사이트 수준에서 구성됩니다.
특성
attribute | Description |
---|---|
enabled |
선택적 부울 특성입니다. 사용자 지정 권한 부여 공급자가 권한 부여에 사용되도록 지정합니다. 그렇지 않으면 기본 제공 공급자가 사용됩니다. 기본값은 true 입니다. |
name |
선택적 문자열 특성입니다. 권한 부여에 사용할 사용자 지정 권한 부여 공급자를 지정합니다. 공급자 이름이 드롭다운 목록에서 선택됩니다. |
자식 요소
없음
구성 샘플
다음 샘플에서는 요소를 표시합니다.<customAuthorization>
<ftpServer>
<security>
<customAuthorization>
<provider name="MyProvider" enabled="true" />
</customAuthorization>
</security>
</ftpServer>
다음 샘플에서는 앞의 예제에서 < 사용자 지정 권한 부여 공급자에 대한 providerDefinitions 요소를 표시합니다>.
<system.ftpServer>
<providerDefinitions>
<add name="MyProvider" type="MyProvider, MyProvider, version=1.0.0.0, Culture=neutral, PublicKeyToken=426f62526f636b73" />
</providerDefinitions>
</system.ftpServer>
샘플 코드
다음 코드 샘플은 사용자 지정 권한 부여 공급자를 구성합니다.
AppCmd.exe
appcmd.exe set config -section:system.applicationHost/sites /[name='MyFTPSite'].ftpServer.security.customAuthorization.provider.name:"MyProvider" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /[name='MyFTPSite'].ftpServer.security.customAuthorization.provider.enabled:"True" /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 sitesSection = config.GetSection("system.applicationHost/sites");
ConfigurationElementCollection sitesCollection = sitesSection.GetCollection();
ConfigurationElement siteElement = FindElement(sitesCollection, "site", "name", @"MyFTPSite");
if (siteElement == null) throw new InvalidOperationException("Element not found!");
ConfigurationElement ftpServerElement = siteElement.GetChildElement("ftpServer");
ConfigurationElement securityElement = ftpServerElement.GetChildElement("security");
ConfigurationElement customAuthorizationElement = securityElement.GetChildElement("customAuthorization");
ConfigurationElement providerElement = customAuthorizationElement.GetChildElement("provider");
providerElement["name"] = @"MyProvider";
providerElement["enabled"] = true;
serverManager.CommitChanges();
}
}
private static ConfigurationElement FindElement(ConfigurationElementCollection collection, string elementTagName, params string[] keyValues) {
foreach (ConfigurationElement element in collection) {
if (String.Equals(element.ElementTagName, elementTagName, StringComparison.OrdinalIgnoreCase)) {
bool matches = true;
for (int i = 0; i < keyValues.Length; i += 2) {
object o = element.GetAttributeValue(keyValues[i]);
string value = null;
if (o != null) {
value = o.ToString();
}
if (!String.Equals(value, keyValues[i + 1], StringComparison.OrdinalIgnoreCase)) {
matches = false;
break;
}
}
if (matches) {
return element;
}
}
}
return null;
}
}
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 sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")
Dim sitesCollection As ConfigurationElementCollection = sitesSection.GetCollection
Dim siteElement As ConfigurationElement = FindElement(sitesCollection, "site", "name", "MyFTPSite")
If (siteElement Is Nothing) Then
Throw New InvalidOperationException("Element not found!")
End If
Dim ftpServerElement As ConfigurationElement = siteElement.GetChildElement("ftpServer")
Dim securityElement As ConfigurationElement = ftpServerElement.GetChildElement("security")
Dim customAuthorizationElement As ConfigurationElement = securityElement.GetChildElement("customAuthorization")
Dim providerElement As ConfigurationElement = customAuthorizationElement.GetChildElement("provider")
providerElement("name") = "MyProvider"
providerElement("enabled") = true
serverManager.CommitChanges
End Sub
Private Shared Function FindElement(ByVal collection As ConfigurationElementCollection, ByVal elementTagName As String, ParamArray ByVal keyValues() As String) As ConfigurationElement
For Each element As ConfigurationElement In collection
If String.Equals(element.ElementTagName, elementTagName, StringComparison.OrdinalIgnoreCase) Then
Dim matches As Boolean = true
Dim i As Integer = 0
Do While (i < keyValues.Length)
Dim o As Object = element.GetAttributeValue(keyValues(i))
Dim value As String = Nothing
If (Not (o) Is Nothing) Then
value = o.ToString
End If
If Not String.Equals(value, keyValues((i + 1)), StringComparison.OrdinalIgnoreCase) Then
matches = false
Exit For
End If
i = (i + 2)
Loop
If matches Then
Return element
End If
End If
Next
Return Nothing
End Function
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
var sitesCollection = sitesSection.Collection;
var siteElementPos = FindElement(sitesCollection, "site", ["name", "MyFTPSite"]);
if (siteElementPos == -1) throw "Element not found!";
var siteElement = sitesCollection.Item(siteElementPos);
var ftpServerElement = siteElement.ChildElements.Item("ftpServer");
var securityElement = ftpServerElement.ChildElements.Item("security");
var customAuthorizationElement = securityElement.ChildElements.Item("customAuthorization");
var providerElement = customAuthorizationElement.ChildElements.Item("provider");
providerElement.Properties.Item("name").Value = "MyProvider";
providerElement.Properties.Item("enabled").Value = true;
adminManager.CommitChanges();
function FindElement(collection, elementTagName, valuesToMatch) {
for (var i = 0; i < collection.Count; i++) {
var element = collection.Item(i);
if (element.Name == elementTagName) {
var matches = true;
for (var iVal = 0; iVal < valuesToMatch.length; iVal += 2) {
var property = element.GetPropertyByName(valuesToMatch[iVal]);
var value = property.Value;
if (value != null) {
value = value.toString();
}
if (value != valuesToMatch[iVal + 1]) {
matches = false;
break;
}
}
if (matches) {
return i;
}
}
}
return -1;
}
VBScript
Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST")
Set sitesCollection = sitesSection.Collection
siteElementPos = FindElement(sitesCollection, "site", Array ("name", "MyFTP"))
if (siteElementPos = -1) THEN throw "Element not found!"
Set siteElement = sitesCollection.Item(siteElementPos)
Set ftpServerElement = siteElement.ChildElements.Item("ftpServer")
Set securityElement = ftpServerElement.ChildElements.Item("security")
Set customAuthorizationElement = securityElement.ChildElements.Item("customAuthorization")
Set providerElement = customAuthorizationElement.ChildElements.Item("provider")
providerElement.Properties.Item("name").Value = "MyProvider1"
providerElement.Properties.Item("enabled").Value = true
adminManager.CommitChanges()
Function FindElement(collection, elementTagName, valuesToMatch)
For i = 0 To CInt(collection.Count) - 1
Set element = collection.Item(i)
If element.Name = elementTagName Then
matches = True
For iVal = 0 To UBound(valuesToMatch) Step 2
Set property = element.GetPropertyByName(valuesToMatch(iVal))
value = property.Value
If Not IsNull(value) Then
value = CStr(value)
End If
If Not value = CStr(valuesToMatch(iVal + 1)) Then
matches = False
Exit For
End If
Next
If matches Then
Exit For
End If
End If
Next
If matches Then
FindElement = i
Else
FindElement = -1
End If
End Function
PowerShell
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/sites/site[@name='MyFTPSite']/ftpServer/security/customAuthorization/provider" -name "name" -value "MyProvider"
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/sites/site[@name='MyFTPSite']/ftpServer/security/customAuthorization/provider" -name "enabled" -value "True"