次の方法で共有


<system.ftpServer>

概要

<system.ftpServer> 要素は、ApplicationHost.config ファイルでの FTP 7 のグローバル レベルおよび URL レベルの構成設定を指定し、FTP サービスで使われる設定を定義する構成要素が含まれます。

Note

<system.webServer> 要素にある設定とは異なり、<system.ftpServer> 要素の設定は委任することができません。

互換性

バージョン メモ
IIS 10.0 <system.ftpServer> 要素は、IIS 10.0 では変更されませんでした。
IIS 8.5 <system.ftpServer> 要素は、IIS 8.5 では変更されませんでした。
IIS 8.0 <system.ftpServer> 要素は IIS 8.0 では変更されませんでした。
IIS 7.5 <system.ftpServer> 要素は、IIS 7.5 の機能として付属しています。
IIS 7.0 <system.ftpServer> 要素が、IIS 7.0 用の別個のダウンロードとして FTP 7.0 で導入されました。
IIS 6.0 <system.ftpServer> 要素とその子要素は、LM/MSFTPSVC メタベース パスにある IIS 6.0 の FTP 設定を置き換えます。

Note

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 サービスのダウンロードは必要なくなりました。

段取り

Web サーバーの FTP 公開をサポートするには、FTP サービスをインストールする必要があります。 そのためには、次のステップに従います。

Windows Server 2012 または Windows Server 2012 R2

  1. タスク バーで [サーバー マネージャー]をクリックします。

  2. [サーバー マネージャー] で、[管理] メニューを選択し、[役割と機能の追加] を選択します。

  3. [役割と機能の追加] ウィザードで、[次へ] をクリックします。 インストールの種類を選択し、[次へ] をクリックします。 対象サーバーを選択し、[次へ] をクリックします。

  4. [サーバーの役割] ページで、[Web サーバー (IIS)] を展開して、[FTP サーバー] を選びます。

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP Service] に加えて[FTP 拡張] も選択する必要があります。

    展開された [ロール] メニューのスクリーンショット。F T P 拡張機能が強調表示されています。 .

  5. [次へ] をクリックし、[機能の選択] ページで再度 [次へ] をクリックします。

  6. [インストール オプションの確認] ページで、[インストール] をクリックします。

  7. [結果] ページで、 [閉じる]をクリックします。

Windows 8 または Windows 8.1

  1. [スタート] 画面で、ポインターを左下隅まで移動し、[スタート] ボタンを右クリックし、[コントロール パネル] をクリックします。

  2. [コントロール パネル][プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。

  3. [インターネット インフォメーション サービス] を展開し、[FTP サーバー] を展開します。

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。

    展開されたメニューで F T P 拡張機能が強調表示されている [Windows 機能] ダイアログ ボックスのスクリーンショット。

  4. OK をクリックします。

  5. 閉じるをクリックします。

Windows Server 2008 R2

  1. タスク バーで [スタート] をクリックし、[管理ツール] をポイントして、[サーバー マネージャ] をクリックします。

  2. [サーバー マネージャ] 階層ウィンドウで [役割] を展開し、[Web サーバー (IIS)] をクリックします。

  3. [Web サーバー (IIS)] ウィンドウで、[役割サービス] セクションまでスクロールし、[役割サービスの追加] をクリックします。

  4. [役割サービスの追加] ウィザード[役割サービスの選択] ページで [FTP サーバー] を展開します。

  5. [FTP Service] を選択します。

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。

    展開されたメニューで F T P サービスが強調表示されている [ロール サービスの追加] ページのスクリーンショット。

  6. 次へ をクリックします。

  7. [インストール オプションの確認] ページで、[インストール] をクリックします。

  8. [結果] ページで、 [閉じる]をクリックします。

Windows 7

  1. タスク バーで、[スタート][コントロール パネル] の順にクリックします。

  2. [コントロール パネル][プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。

  3. [インターネット インフォメーション サービス][FTP サーバー] の順に展開します。

  4. [FTP Service] を選択します。

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。

    [o k] ボタンが強調表示されている [Windows の機能] ダイアログ ボックスのスクリーンショット。

  5. OK をクリックします。

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 ログ] 機能をダブルクリックします。
    [I I S Manager ホーム] ウィンドウのスクリーンショット。F T P ログ機能が強調表示されています。

  4. [ログ ファイル作成単位] ドロップダウン リストで、次のオプションのいずれかを選びます。

    • [サイト] を選び、各 FTP サイトが個別のログ ファイルに書き込むように指定します。
    • すべての FTP サイトに対して 1 つのログ ファイルを指定するには、[サーバー] を選びます。
      [I I S Manager F T P ログ] タブのスクリーンショット。
  5. [操作] ウィンドウで、[適用] をクリックします。

構成

<system.ftpServer> 要素の設定は、グローバル レベル、サイト レベル、URL ごとに構成できます。

属性

なし。

子要素

要素 説明
log 省略可能な要素です。

FTP サービスのグローバル ログ設定を指定します。
firewallSupport 省略可能な要素です。

FTP サービスがデータ チャネル通信に使うポート範囲を指定します。
providerDefinitions 省略可能な要素です。

カスタム FTP プロバイダーのコレクションを指定します。
security 省略可能な要素です。

FTP のセキュリティ関連の設定を指定します。
caching 省略可能な要素です。

FTP サービスの資格情報キャッシュ設定を指定します。
serverRuntime 省略可能な要素です。

FTP サービスの動作方法を構成する設定を指定します。

構成サンプル

次のサンプルは、サーバーのグローバル <system.ftpServer> 要素のいくつかの構成設定を示しています。 具体的には、この例の設定では、次の方法を示します。

  • FTP 資格情報のキャッシュを有効にし、タイムアウトを 10 分 (600 秒) に指定します。

  • データ チャネル通信用に、下限ポートを 5000 に、上限ポートを 6000 に構成します。

  • ログを有効にし、ログ ファイルがサイトごとに保存され、ログ ファイルが UTC 時間で毎日ローテーションされるように指定します。

  • カスタム FTP プロバイダーを指定し、そのプロバイダーのカスタム パラメーターを指定します。

  • ローカル ホストからの FTP アクセスを許可し、IP アドレス 169.254.0.0 から 169.254.255.255 のブロックへのアクセスを拒否するグローバル IP 制限を指定します。

  • 次のオプションを使って要求のフィルタリングを構成します。

    • FrontPage Server Extensions で使われる _vti_bin 仮想ディレクトリへの FTP アクセスをブロックします。
    • 実行可能ファイルに関連付けられているいくつかのファイルの種類をブロックします。
    • 最大ファイル サイズとして 100 MB を指定します。
  • 管理者グループのアクセスを許可するグローバル認可規則を追加します。

  • FTP 仮想ホスト名にドメイン名構文を使用できるように指定します。

<system.ftpServer>
   <caching>
      <credentialsCache enabled="true" flushInterval="600" />
   </caching>
   <firewallSupport lowDataChannelPort="5000" highDataChannelPort="6000" />
   <log centralLogFileMode="Site">
      <centralLogFile period="Daily" localTimeRollover="false" enabled="true" />
   </log>
   <providerDefinitions>
      <add name="FtpXmlAuthentication"
         type="FtpXmlAuthentication, FtpXmlAuthentication, version=1.0.0.0, Culture=neutral, PublicKeyToken=426f62526f636b73" />
      <activation>
         <providerData name="FtpXmlAuthentication">
            <add key="xmlFileName" value="C:\Inetpub\XmlSample\Users.xml" />
         </providerData>
      </activation>
   </providerDefinitions>
   <security>
      <ipSecurity enableReverseDns="false" allowUnlisted="true">
         <add ipAddress="169.254.0.0" subnetMask="255.255.0.0" allowed="false" />
         <add ipAddress="127.0.0.1" allowed="true" />
      </ipSecurity>
      <requestFiltering>
         <hiddenSegments>
            <add segment="_vti_bin" />
         </hiddenSegments>
         <fileExtensions allowUnlisted="true">
            <add fileExtension="exe" allowed="false" />
            <add fileExtension="cmd" allowed="false" />
            <add fileExtension="com" allowed="false" />
            <add fileExtension="bat" allowed="false" />
         </fileExtensions>
         <requestLimits maxAllowedContentLength="104857600" />
      </requestFiltering>
      <authorization>
         <add accessType="Allow" roles="administrators" permissions="Read, Write" />
      </authorization>
   </security>
   <serverRuntime>
      <hostNameSupport useDomainNameAsHostName="true" />
   </serverRuntime>
</system.ftpServer>

サンプル コード

次の例では、既定の Web サイトに 2 つの FTP 認可規則を追加します。 最初の規則では管理者グループの読み取りと書き込みアクセスが許可され、2 番目の規則ではゲスト アカウントの読み取りと書き込みアクセスが拒否されます。

AppCmd.exe

appcmd.exe set config "Default Web Site" -section:system.ftpServer/security/authorization /+"[accessType='Allow',roles='administrators',permissions='Read, Write']" /commit:apphost

appcmd.exe set config "Default Web Site" -section:system.ftpServer/security/authorization /+"[accessType='Deny',users='guest',permissions='Read, Write']" /commit:apphost

Note

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 authorizationSection = config.GetSection("system.ftpServer/security/authorization", "Default Web Site");
         ConfigurationElementCollection authorizationCollection = authorizationSection.GetCollection();

         ConfigurationElement addElement = authorizationCollection.CreateElement("add");
         addElement["accessType"] = @"Allow";
         addElement["roles"] = @"administrators";
         addElement["permissions"] = @"Read, Write";
         authorizationCollection.Add(addElement);

         ConfigurationElement addElement1 = authorizationCollection.CreateElement("add");
         addElement1["accessType"] = @"Deny";
         addElement1["users"] = @"guest";
         addElement1["permissions"] = @"Read, Write";
         authorizationCollection.Add(addElement1);

         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 authorizationSection As ConfigurationSection = config.GetSection("system.ftpServer/security/authorization", "Default Web Site")
      Dim authorizationCollection As ConfigurationElementCollection = authorizationSection.GetCollection

      Dim addElement As ConfigurationElement = authorizationCollection.CreateElement("add")
      addElement("accessType") = "Allow"
      addElement("roles") = "administrators"
      addElement("permissions") = "Read, Write"
      authorizationCollection.Add(addElement)

      Dim addElement1 As ConfigurationElement = authorizationCollection.CreateElement("add")
      addElement1("accessType") = "Deny"
      addElement1("users") = "guest"
      addElement1("permissions") = "Read, Write"
      authorizationCollection.Add(addElement1)

      serverManager.CommitChanges()
   End Sub
End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var authorizationSection = adminManager.GetAdminSection("system.ftpServer/security/authorization", "MACHINE/WEBROOT/APPHOST/Default Web Site");
var authorizationCollection = authorizationSection.Collection;

var addElement = authorizationCollection.CreateNewElement("add");
addElement.Properties.Item("accessType").Value = "Allow";
addElement.Properties.Item("roles").Value = "administrators";
addElement.Properties.Item("permissions").Value = "Read, Write";
authorizationCollection.AddElement(addElement);

var addElement1 = authorizationCollection.CreateNewElement("add");
addElement1.Properties.Item("accessType").Value = "Deny";
addElement1.Properties.Item("users").Value = "guest";
addElement1.Properties.Item("permissions").Value = "Read, Write";
authorizationCollection.AddElement(addElement1);

adminManager.CommitChanges();

VBScript

Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

Set authorizationSection = adminManager.GetAdminSection("system.ftpServer/security/authorization", "MACHINE/WEBROOT/APPHOST/Default Web Site")
Set authorizationCollection = authorizationSection.Collection

Set addElement = authorizationCollection.CreateNewElement("add")
addElement.Properties.Item("accessType").Value = "Allow"
addElement.Properties.Item("roles").Value = "administrators"
addElement.Properties.Item("permissions").Value = "Read, Write"
authorizationCollection.AddElement(addElement)

Set addElement1 = authorizationCollection.CreateNewElement("add")
addElement1.Properties.Item("accessType").Value = "Deny"
addElement1.Properties.Item("users").Value = "guest"
addElement1.Properties.Item("permissions").Value = "Read, Write"
authorizationCollection.AddElement(addElement1)

adminManager.CommitChanges()

次の例では、FTP 仮想ホスト名のドメイン名構文を許可するように FTP サーバーの <serverRuntime> 要素を構成します。

AppCmd.exe

appcmd.exe set config -section:system.ftpServer/serverRuntime /hostNameSupport.useDomainNameAsHostName:"True" /commit:apphost

Note

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 serverRuntimeSection = config.GetSection("system.ftpServer/serverRuntime");

         ConfigurationElement hostNameSupportElement = serverRuntimeSection.GetChildElement("hostNameSupport");
         hostNameSupportElement["useDomainNameAsHostName"] = true;

         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 serverRuntimeSection As ConfigurationSection = config.GetSection("system.ftpServer/serverRuntime")

      Dim hostNameSupportElement As ConfigurationElement = serverRuntimeSection.GetChildElement("hostNameSupport")
      hostNameSupportElement("useDomainNameAsHostName") = True

      serverManager.CommitChanges()
   End Sub
End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var serverRuntimeSection = adminManager.GetAdminSection("system.ftpServer/serverRuntime", "MACHINE/WEBROOT/APPHOST");
var hostNameSupportElement = serverRuntimeSection.ChildElements.Item("hostNameSupport");
hostNameSupportElement.Properties.Item("useDomainNameAsHostName").Value = true;

adminManager.CommitChanges();

VBScript

Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

Set serverRuntimeSection = adminManager.GetAdminSection("system.ftpServer/serverRuntime", "MACHINE/WEBROOT/APPHOST")
Set hostNameSupportElement = serverRuntimeSection.ChildElements.Item("hostNameSupport")
hostNameSupportElement.Properties.Item("useDomainNameAsHostName").Value = True

adminManager.CommitChanges()