다음을 통해 공유


FTP 메시지 <메시지>

개요

요소는 <messages> FTP 서비스가 FTP 클라이언트에 표시할 메시지를 지정하는 데 사용됩니다. , greetingMessagemaxClientsMessage 특성에 대해 bannerMessage지정된 메시지는 FTP 클라이언트가 FTP 사이트에 연결할 때 표시되고 FTP 클라이언트가 FTP 사이트에서 연결을 끊을 때 특성으로 exitMessage 지정된 메시지가 표시됩니다.

suppressDefaultBanner 특성을 특성과 bannerMessage 함께 사용하여 FTP 서버 유형을 위장할 수 있습니다. 기본 배너가 표시되지 않고 특성에 bannerMessage 배너 메시지가 지정되지 않은 경우 FTP 클라이언트가 서버에 연결할 때 FTP 서버는 빈 배너를 표시합니다.

특성은 expandVariables FTP 메시지에 특정 사용자 변수 집합을 표시할지 여부를 지정합니다. 이 특성이 true로 설정된 경우 FTP 서비스는 FTP 메시지에 사용자 변수를 표시합니다. 그렇지 않으면 모든 메시지 텍스트가 입력된 대로 표시됩니다. 지원되는 사용자 변수는 다음과 같습니다.

User 변수 Description
%BytesReceived% 현재 세션에 대해 서버에서 클라이언트로 전송된 바이트 수입니다.
%BytesSent% 현재 세션에 대해 클라이언트에서 서버로 전송된 바이트 수입니다.
%SessionID% 현재 세션의 고유 식별자입니다.
%SiteName% 현재 세션을 호스트하는 FTP 사이트의 이름입니다.
%UserName% 현재 로그온한 사용자의 계정 이름입니다.

특성은 allowLocalDetailedErrors FTP 클라이언트가 서버 자체의 FTP 서버에 연결할 때 자세한 오류 메시지를 표시할지 여부를 지정합니다. 이러한 오류 메시지에는 서버 관리자가 문제를 해결하는 데 사용할 수 있는 자세한 정보가 포함되어 있습니다. 이 특성이 true로 설정된 경우 FTP 서비스는 로컬 호스트에만 자세한 오류 메시지를 표시합니다. 그렇지 않으면 자세한 오류 메시지가 표시되지 않습니다.

호환성

버전 참고
IIS 10.0 <messages> 요소가 IIS 10.0에서 수정되지 않았습니다.
IIS 8.5 <messages> 요소가 IIS 8.5에서 수정되지 않았습니다.
IIS 8.0 <messages> 요소가 IIS 8.0에서 수정되지 않았습니다.
IIS 7.5 <messages> 요소의 <ftpServer> 요소는 IIS 7.5의 기능으로 제공됩니다.
IIS 7.0 <messages> 요소의 <ftpServer> 요소는 IIS 7.0에 대한 별도의 다운로드인 FTP 7.0에서 도입되었습니다.
IIS 6.0 해당 없음

참고

FTP 7.0 및 FTP 7.5 서비스는 IIS 7.0용 대역 외 서비스를 제공했으며, 다음 URL에서 모듈을 다운로드하고 설치해야 했습니다.

https://www.iis.net/expand/FTP

Windows 7 및 Windows Server 2008 R2에서는 FTP 7.5 서비스가 IIS 7.5의 기능으로 제공됩니다. 따라서 FTP 서비스를 더 이상 다운로드할 필요가 없습니다.

설치 프로그램

웹 서버에 대한 FTP 게시를 지원하려면 FTP 서비스를 설치해야 합니다. 이렇게 하려면 다음 단계를 수행합니다.

Windows Server 2012 또는 Windows Server 2012 R2

  1. 작업 표시줄에서 서버 관리자를 클릭합니다.

  2. 서버 관리자관리 메뉴를 클릭한 다음 역할 및 기능 추가를 클릭합니다.

  3. 역할 및 기능 추가 마법사에서 다음을 클릭합니다. 설치 유형을 선택하고 다음을 클릭합니다. 대상 서버를 선택하고 다음을 클릭합니다.

  4. 서버 역할 페이지에서 웹 서버(IIS)를 확장한 다음 FTP 서버를 선택합니다.

    참고

    ASP를 지원합니다. FTP 서비스에 대한 멤버 자격 인증 또는 IIS 관리자 인증은 FTP 서비스 외에도 FTP 확장성을 선택해야 합니다.
    Windows Server 2012 인터페이스에서 선택한 FTP 서비스 및 FTP 확장성의 스크린샷 .

  5. 다음을 클릭한 다음 기능 선택 페이지에서 다음을 다시 클릭합니다.

  6. 설치 선택 확인 페이지에서 설치를 클릭합니다.

  7. Results(결과) 페이지에서 Close(닫기)를 클릭합니다.

Windows 8 또는 Windows 8.1

  1. 시작 화면에서 포인터를 왼쪽 아래 모서리로 이동하고 시작 단추를 마우스 오른쪽 단추로 클릭한 다음 제어판 클릭합니다.

  2. 제어판프로그램 및 기능을 클릭한 다음 Windows 기능 켜기 또는 끄기를 클릭합니다.

  3. 인터넷 정보 서비스를 확장한 다음 FTP 서버를 선택합니다.

    참고

    ASP를 지원합니다. FTP 서비스에 대한 멤버 자격 인증 또는 IIS 관리자 인증도 FTP 확장성을 선택해야 합니다.
    Windows 8 인터페이스에서 선택한 F T P 서비스 및 F T P 확장성의 스크린샷.

  4. 확인을 클릭합니다.

  5. 닫기를 클릭합니다.

Windows Server 2008 R2

  1. 작업 표시줄에서 시작을 클릭하고 관리 도구를 가리킨 다음 서버 관리자 클릭합니다.

  2. 서버 관리자 계층 창에서 역할을 확장한 다음 웹 서버(IIS)를 클릭합니다.

  3. 웹 서버(IIS) 창에서 역할 서비스 섹션으로 스크롤한 다음 역할 서비스 추가를 클릭합니다.

  4. 역할 서비스 추가 마법사역할 서비스 선택 페이지에서 FTP 서버를 확장합니다.

  5. FTP 서비스를 선택합니다.

    참고

    ASP를 지원합니다. FTP 서비스에 대한 멤버 자격 인증 또는 IIS 관리자 인증도 FTP 확장성을 선택해야 합니다.
    Windows Server 2008 인터페이스에서 선택한 FTP 서비스 및 FTP 확장성의 스크린샷

  6. 다음을 클릭합니다.

  7. 설치 선택 확인 페이지에서 설치를 클릭합니다.

  8. Results(결과) 페이지에서 Close(닫기)를 클릭합니다.

Windows 7

  1. 작업 표시줄에서 시작을 클릭한 다음 제어판 클릭합니다.

  2. 제어판프로그램 및 기능을 클릭한 다음 Windows 기능 켜기 또는 끄기를 클릭합니다.

  3. 인터넷 정보 서비스를 확장한 다음 FTP 서버를 확장합니다.

  4. FTP 서비스를 선택합니다.

    참고

    ASP를 지원합니다. FTP 서비스에 대한 멤버 자격 인증 또는 IIS 관리자 인증도 FTP 확장성을 선택해야 합니다.
    Windows 7 인터페이스에서 선택한 F T P 서비스 및 F T P 확장성의 스크린샷

  5. 확인을 클릭합니다.

Windows Server 2008 또는 Windows Vista

  1. 다음 URL에서 설치 패키지를 다운로드합니다.

  2. 다음 연습의 지침에 따라 FTP 서비스를 설치합니다.

방법

FTP 사이트에 대해 사용자 지정된 메시지를 구성하는 방법

  1. IIS(인터넷 정보 서비스) 관리자를 엽니다.

    • Windows Server 2012 또는 Windows Server 2012 R2를 사용하는 경우:

      • 작업 표시줄에서 서버 관리자 클릭하고 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 클릭합니다.
    • Windows 8 또는 Windows 8.1 사용하는 경우:

      • Windows 키를 누른 채로 문자 X를 누른 다음 제어판 클릭합니다.
      • 관리 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
    • Windows Server 2008 또는 Windows Server 2008 R2를 사용하는 경우:

      • 작업 표시줄에서 시작을 클릭하고 관리 도구를 가리킨 다음 IIS(인터넷 정보 서비스) 관리자를 클릭합니다.
    • Windows Vista 또는 Windows 7을 사용하는 경우:

      • 작업 표시줄에서 시작을 클릭한 다음 제어판 클릭합니다.
      • 관리 도구를 두 번 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
  2. 연결 창에서 서버 이름을 확장하고 사이트 노드를 확장한 다음 사이트 이름을 클릭합니다.

  3. 사이트의 창에서 FTP 메시지 기능을 두 번 클릭합니다.
    웹 사이트 홈 창에서 선택한 F T P 메시지 옵션의 스크린샷.

  4. 다음 옵션을 구성합니다.

    • 기본 배너 표시 안 함 옵션을 클릭하여 선택합니다.
    • 메시지에서 사용자 변수 지원 옵션을 선택하려면 클릭합니다.
    • 배너 메시지에 "내 FTP 서버입니다"를 입력합니다.
    • 시작 메시지에 "Hello %UserName%!"을 입력합니다.
    • 종료 메시지에 "Goodbye %UserName%!"을 입력합니다.
      F T P 메시지 창에서 로컬 요청에 대한 자세한 메시지 표시로 설정된 메시지 동작의 스크린샷
  5. 작업 창에서 적용을 클릭합니다.

구성

사이트 수준 <messages> 요소는 사이트 수준에서 구성됩니다.

특성

attribute Description
allowLocalDetailedErrors 선택적 부울 특성입니다.

자세한 오류 메시지를 로컬로 표시해야 하는 경우 true입니다. 그렇지 않으면 false입니다.

참고: 자세한 오류 메시지는 원격으로 표시할 수 없습니다.

기본값은 true입니다.
bannerMessage 선택적 문자열 특성입니다.

클라이언트가 FTP 서버에 연결할 때 표시되는 메시지를 지정합니다.

기본값은 없습니다.
exitMessage 선택적 문자열 특성입니다.

클라이언트가 FTP 서버에 대한 연결을 닫을 때 표시되는 메시지를 지정합니다.

기본값은 없습니다.
expandVariables 선택적 부울 특성입니다.

사용자 변수를 확장해야 하는 경우 true입니다. 그렇지 않으면 false입니다.

기본값은 false입니다.
greetingMessage 선택적 문자열 특성입니다.

클라이언트가 FTP 서버에 로그인한 후 표시되는 메시지를 지정합니다.

기본값은 없습니다.
maxClientsMessage 선택적 문자열 특성입니다.

클라이언트가 로그인을 시도하고 FTP 서버에서 최대 클라이언트 수에 이미 도달했을 때 표시되는 메시지를 지정합니다.

기본값은 없습니다.
suppressDefaultBanner 선택적 부울 특성입니다.

FTP 서비스가 기본 "Microsoft FTP 서비스" 배너를 표시하지 않으면 true입니다. 그렇지 않으면 false입니다.

기본값은 false입니다.

자식 요소

없음

구성 샘플

다음 샘플에서는 여러 사용자 지정된 FTP 메시지를 클라이언트에 반환하고, 기본 FTP 배너를 표시하지 않으며, 로컬 FTP 서버에 로그온된 FTP 클라이언트에 자세한 오류 메시지를 표시하도록 FTP 서비스를 구성하는 FTP 사이트의 요소를 표시 <messages> 합니다.

<site name="ftp.example.com" id="5">
  <application path="/">
    <virtualDirectory path="/" physicalPath="c:\inetpub\www.example.com" />
  </application>
  <bindings>
    <binding protocol="ftp" bindingInformation="*:21:" />
  </bindings>
  <ftpServer>
    <messages exitMessage="Goodbye %UserName%!"
      greetingMessage="Hello %UserName%!"
      bannerMessage="This my FTP server."
      suppressDefaultBanner="true"
      allowLocalDetailedErrors="true"
      expandVariables="true" />
    <security>
      <authentication>
        <basicAuthentication enabled="true" />
        <anonymousAuthentication enabled="false" />
      </authentication>
    </security>
  </ftpServer>
</site>

샘플 코드

다음 예제에서는 기본 배너를 표시하지 않도록 FTP 사이트를 구성하고 사용자 지정 배너 메시지를 반환합니다.

AppCmd.exe

appcmd.exe set config -section:system.applicationHost/sites /[name='ftp.example.com'].ftpServer.messages.bannerMessage:"This is my FTP Server!" /commit:apphost

appcmd.exe set config -section:system.applicationHost/sites /[name='ftp.example.com'].ftpServer.messages.suppressDefaultBanner:"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", @"ftp.example.com");
         if (siteElement == null) throw new InvalidOperationException("Element not found!");
         ConfigurationElement ftpServerElement = siteElement.GetChildElement("ftpServer");

         ConfigurationElement messagesElement = ftpServerElement.GetChildElement("messages");
         messagesElement["bannerMessage"] = @"This is my FTP Server!";
         messagesElement["suppressDefaultBanner"] = 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", "ftp.example.com")
      If (siteElement Is Nothing) Then
         Throw New InvalidOperationException("Element not found!")
      End If
      Dim ftpServerElement As ConfigurationElement = siteElement.GetChildElement("ftpServer")

      Dim messagesElement As ConfigurationElement = ftpServerElement.GetChildElement("messages")
      messagesElement("bannerMessage") = "This is my FTP Server!"
      messagesElement("suppressDefaultBanner") = True

      serverManager.CommitChanges()
   End Sub

   Private Function FindElement(ByVal collection As ConfigurationElementCollection, ByVal elementTagName As String, ByVal ParamArray 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
            For i = 0 To keyValues.Length - 1 Step 2
               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
            Next
            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", "ftp.example.com"]);
if (siteElementPos == -1) throw "Element not found!";
var siteElement = sitesCollection.Item(siteElementPos);
var ftpServerElement = siteElement.ChildElements.Item("ftpServer");

var messagesElement = ftpServerElement.ChildElements.Item("messages");
messagesElement.Properties.Item("bannerMessage").Value = "This is my FTP Server!";
messagesElement.Properties.Item("suppressDefaultBanner").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", "ftp.example.com"))
If siteElementPos = -1 Then
   WScript.Echo "Element not found!"
   WScript.Quit
End If
Set siteElement = sitesCollection.Item(siteElementPos)
Set ftpServerElement = siteElement.ChildElements.Item("ftpServer")

Set messagesElement = ftpServerElement.ChildElements.Item("messages")
messagesElement.Properties.Item("bannerMessage").Value = "This is my FTP Server!"
messagesElement.Properties.Item("suppressDefaultBanner").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