次の方法で共有


既定の FTP セキュリティ設定 <security>

概要

<security> 要素は、FTP サイトのセキュリティ オプションの親要素を定義し、階層的に表示される次の子要素を持ちます。

  • <authentication> - この子要素は、FTP サイトのさまざまな認証設定の親要素であり、次の子要素を持ちます。

    • <anonymousAuthentication> - 匿名アクセスの設定を指定します。 この形式の認証を使うと、サーバーまたはドメイン上にユーザー アカウントがなくても FTP サイトにアクセスできます。パブリック FTP サイトに最もよく使われます。
    • <basicAuthentication> - 基本認証の設定を指定します。 この形式の認証は、ユーザーがログインするために、サーバーまたはドメイン上に有効なユーザー アカウントを必要とします。
    • <clientCertAuthentication> - Active Directory クライアント証明書認証を有効にするかどうかを指定します。 この形式の認証は、クライアント証明書を使って FTP クライアントを認証します。
    • <customAuthentication> - カスタム認証の設定を指定します。 この形式の認証は、カスタム認証プロバイダーを使用してユーザー名とパスワードを検証します。
  • <commandFiltering> - FTP コマンド フィルターの設定を指定します。 このコレクションを使うと、FTP サービスの特定の FTP コマンドを個別に許可または拒否できます。

  • <customAuthorization> - カスタム承認の設定を指定します。 この形式の承認は、組み込みの承認プロバイダーまたはカスタム承認プロバイダーを使ってユーザー アクセスを検証します。

  • <dataChannelSecurity> - FTP データ チャネル セキュリティの設定を指定します。 このセキュリティ機能は、セッションのデータ チャネルとコントロール チャネルが一致するクライアント アドレスを持つように強制します。

  • <ssl> - FTP サイトの Secure Sockets Layer (SSL) 設定を指定します。

  • <sslClientCertificates> - FTP サイトの Secure Sockets Layer (SSL) クライアント証明書設定を指定します。

互換性

バージョン メモ
IIS 10.0 <security> 要素は IIS 10.0 では変更されませんでした。
IIS 8.5 <security> 要素は IIS 8.5 では変更されませんでした。
IIS 8.0 <security> 要素は IIS 8.0 では変更されませんでした。
IIS 7.5 <ftpServer> 要素の <security> 要素は、IIS 7.5 の機能として付属しています。
IIS 7.0 <ftpServer> 要素の <security> 要素が、IIS 7.0 用の別個のダウンロードとして FTP 7.0 で導入されました。
IIS 6.0 <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 拡張] も選択する必要があります。
    Windows Server 2012 で F T P 拡張機能が選択されていることを示すスクリーンショット。 .

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

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

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

Windows 8 または Windows 8.1

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

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

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

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。
    Windows 8 で F T P 拡張機能が選択されていることを示すスクリーンショット。

  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 拡張] も選択する必要があります。
    FTP サービスが選択されていることを示すスクリーンショット。

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

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

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

Windows 7

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

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

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

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

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。
    Windows 7 で FTP 拡張機能が選択されていることを示すスクリーンショット。

  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 認証] 機能をダブルクリックします。

  4. [FTP 認証] ページで、[匿名認証] を選びます。

  5. [操作] ウィンドウで、[有効にする] をクリックして匿名認証を有効にするか、[無効にする] をクリックして匿名認証を無効にします。
    [FTP 認証] ページを示すスクリーンショット。匿名認証が強調表示されています。


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 サイトの追加] をクリックするか、[操作] ペインの [FTP サイトの追加] をクリックします。

  4. FTP サイトの追加ウィザードが表示されたら次の操作を行います。

    • [FTP サイト名] ボックスに「My New FTP Site」と入力します。

    • [物理パス] ボックスには、次のいずれかのオプションを使用してコンテンツ ディレクトリを指定できます。

      • 省略記号 (...) ボタンをクリックし、FTP サイトのコンテンツを含むフォルダーに移動します。
      • ボックスにコンテンツ フォルダーへのパスを入力します。 パスを入力する場合は、パスに環境変数を使用できます。 たとえば、コンテンツ ディレクトリに "%SystemDrive%\inetpub\ftproot" を使用できます。
    • これらの項目が完了したら、[次へ] をクリックします。
      FTP サイトの追加を示すスクリーンショット。サイト情報が表示されます。

  5. FTP サイトの追加ウィザードの 2 番めのページで、次の操作を行います。

    • [IP アドレス] ドロップダウンから FTP サイトの IP アドレスを選択するか、既定の選択値である [すべて未割り当て] を受け入れます。

    • [ポート] ボックスに FTP サイトの TCP/IP ポートを入力します。 既定では、FTP サイトとクライアントはポート 21 を使用します。 (注: 暗黙的 FTPS を指定するには、ポート 990 を使用する必要があります)。

    • FTP 仮想ホスト名を使用するには、[仮想ホスト名を有効にする] ボックスをオンにし、[仮想ホスト] ボックスに仮想ホスト名を入力します。

    • SSL オプションに、次のいずれかのオプションを選びます。

      • SSL オプションを無効にするには、SSL に [無し] を選びます。
      • FTP クライアントが FTP サーバーに接続するときに、必要に応じて FTP over SSL を使用できるようにするには、SSL に [許可] を選びます。
      • FTP クライアントが FTP サーバーに接続するときに、常に FTP over SSL を使用できるようにするには、SSL に [必要] を選びます。
      • SSL に [許可] または [必要] を選択した場合は、[SSL 証明書] ドロップダウン メニューから証明書を選択します。
    • これらの項目が完了したら、[次へ] をクリックします。
      FTP サイトの追加を示すスクリーンショット。バインドと SSL 設定が表示されます。

  6. 次のウィザード ページで次の操作を行います。

    • [認証] 設定に [匿名] を選びます。
    • [承認] 設定で、[アクセスの許可] ドロップダウンから [匿名ユーザー] を選びます。
    • [アクセス許可] オプションの [読み取り] をオンにします。
    • これらの項目が完了したら、[終了] をクリックします。
      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 認証] 機能をダブルクリックします。

  4. [FTP 認証] ページで、[基本認証] を選びます。
    [FTP 認証] ページを示すスクリーンショット。

  5. [操作] ウィンドウで、[有効にする] をクリックして基本認証を有効にするか、[無効にする] をクリックして基本認証を無効にします。


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 サイトの追加] をクリックするか、[操作] ペインの [FTP サイトの追加] をクリックします。

  4. FTP サイトの追加ウィザードが表示されたら次の操作を行います。

    • [FTP サイト名] ボックスに「My New FTP Site」と入力します。

    • [物理パス] ボックスには、次のいずれかのオプションを使用してコンテンツ ディレクトリを指定できます。

      • 省略記号 (...) ボタンをクリックし、FTP サイトのコンテンツを含むフォルダーに移動します。
      • ボックスにコンテンツ フォルダーへのパスを入力します。 パスを入力する場合は、パスに環境変数を使用できます。 たとえば、コンテンツ ディレクトリに "%SystemDrive%\inetpub\ftproot" を使用できます。
    • これらの項目が完了したら、[次へ] をクリックします。
      FTP サイトの追加ウィザードを示すスクリーンショット。

  5. FTP サイトの追加ウィザードの 2 番めのページで、次の操作を行います。

    • [IP アドレス] ドロップダウンから FTP サイトの IP アドレスを選択するか、既定の選択値である [すべて未割り当て] を受け入れます。

    • [ポート] ボックスに FTP サイトの TCP/IP ポートを入力します。 既定では、FTP サイトとクライアントはポート 21 を使用します。 (注: 暗黙的 FTPS を指定するには、ポート 990 を使用する必要があります)。

    • FTP 仮想ホスト名を使用するには、[仮想ホスト名を有効にする] ボックスをオンにし、[仮想ホスト] ボックスに仮想ホスト名を入力します。

    • SSL オプションに、次のいずれかのオプションを選びます。

      • SSL オプションを無効にするには、SSL に [無し] を選びます。
      • FTP クライアントが FTP サーバーに接続するときに、必要に応じて FTP over SSL を使用できるようにするには、SSL に [許可] を選びます。
      • FTP クライアントが FTP サーバーに接続するときに、常に FTP over SSL を使用できるようにするには、SSL に [必要] を選びます。
      • SSL に [許可] または [必要] を選択した場合は、[SSL 証明書] ドロップダウン メニューから証明書を選択します。
    • これらの項目が完了したら、[次へ] をクリックします。
      FTP サイトの追加ウィザードを示すスクリーンショット。バインドと SSL 設定が表示されます。

  6. 次のウィザード ページで次の操作を行います。

    • [認証] 設定に [基本] を選びます。
    • [承認] 設定で、[アクセスの許可] ドロップダウンから [指定されたユーザー] を選び、ドロップダウン メニューの下のボックスにアカウント名を入力します。
    • [アクセス許可] オプションの [読み取り][書き込み] をオンにします。
    • これらの項目が完了したら、[終了] をクリックします。
      FTP サイトの追加を示すスクリーンショット。[認証と承認] で [基本] が選択されています。

構成

属性

なし。

子要素

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

FTP サイトの認証設定を指定します。
commandFiltering 省略可能な要素です。

FTP コマンド フィルターの設定を指定します。
dataChannelSecurity 省略可能な要素です。

FTP データ チャネル セキュリティの設定を指定します。
ssl 省略可能な要素です。

FTP サイトの SSL 設定を指定します。
sslClientCertificates 省略可能な要素です。

FTP サイトの SSL クライアント証明書オプションを指定します。

構成サンプル

次の構成サンプルは、FTP セキュリティ サイトの既定値をいくつか定義するサーバーの <security> 要素の例を示しています。

<siteDefaults>
   <ftpServer>
      <security>
         <commandFiltering>
            <add command="SYST" allowed="false" />
         </commandFiltering>
         <ssl serverCertHash="57686f6120447564652c2049495320526f636b73" controlChannelPolicy="SslAllow" dataChannelPolicy="SslAllow" />
         <sslClientCertificates clientCertificatePolicy="CertIgnore" />
         <authentication>
             <anonymousAuthentication enabled="false" />
             <basicAuthentication enabled="false" />
             <clientCertAuthentication enabled="false" />
             <customAuthentication>
                <providers>
                   <add name="FtpCustomAuthenticationModule" enabled="false" />
                </providers>
             </customAuthentication>
         </authentication>
      </security>
   </ftpServer>
</siteDefaults>

サンプル コード

次のコード サンプルは、FTP サイトのいくつかの既定値の設定を示しています。

AppCmd.exe

appcmd.exe set config -section:system.applicationHost/sites /+"siteDefaults.ftpServer.security.commandFiltering.[command='SYST',allowed='False']" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.ssl.controlChannelPolicy:"SslAllow" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.ssl.dataChannelPolicy:"SslAllow" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.ssl.serverCertHash:"57686f6120447564652c2049495320526f636b73" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.authentication.anonymousAuthentication.enabled:"False" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.authentication.basicAuthentication.enabled:"False" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.authentication.clientCertAuthentication.enabled:"False" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.security.sslClientCertificates.clientCertificatePolicy:"CertIgnore" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites /+"siteDefaults.ftpServer.security.authentication.customAuthentication.providers.[name='FtpCustomAuthenticationModule',enabled='False']" /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 sitesSection = config.GetSection("system.applicationHost/sites");
         ConfigurationElement siteDefaultsElement = sitesSection.GetChildElement("siteDefaults");
         ConfigurationElement ftpServerElement = siteDefaultsElement.GetChildElement("ftpServer");

         ConfigurationElement securityElement = ftpServerElement.GetChildElement("security");
         ConfigurationElement commandFilteringElement = securityElement.GetChildElement("commandFiltering");
         ConfigurationElementCollection commandFilteringCollection = commandFilteringElement.GetCollection();
         ConfigurationElement addElement = commandFilteringCollection.CreateElement("add");
            addElement["command"] = @"SYST";
            addElement["allowed"] = false;
            commandFilteringCollection.Add(addElement);
         ConfigurationElement sslElement = securityElement.GetChildElement("ssl");
            sslElement["controlChannelPolicy"] = @"SslAllow";
            sslElement["dataChannelPolicy"] = @"SslAllow";
            sslElement["serverCertHash"] = "57686f6120447564652c2049495320526f636b73";
         ConfigurationElement authenticationElement = securityElement.GetChildElement("authentication");
         ConfigurationElement anonymousAuthenticationElement = authenticationElement.GetChildElement("anonymousAuthentication");
            anonymousAuthenticationElement["enabled"] = false;
         ConfigurationElement basicAuthenticationElement = authenticationElement.GetChildElement("basicAuthentication");
            basicAuthenticationElement["enabled"] = false;
         ConfigurationElement clientCertAuthenticationElement = authenticationElement.GetChildElement("clientCertAuthentication");
            clientCertAuthenticationElement["enabled"] = false;
         ConfigurationElement sslClientCertificatesElement = securityElement.GetChildElement("sslClientCertificates");
            sslClientCertificatesElement["clientCertificatePolicy"] = @"CertIgnore";
         ConfigurationElement customAuthenticationElement = authenticationElement.GetChildElement("customAuthentication");
         ConfigurationElementCollection providersCollection = customAuthenticationElement.GetCollection("providers");
         ConfigurationElement addElement1 = providersCollection.CreateElement("add");
            addElement1["name"] = @"FtpCustomAuthenticationModule";
            addElement1["enabled"] = false;
            providersCollection.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 sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")
      Dim siteDefaultsElement As ConfigurationElement = sitesSection.GetChildElement("siteDefaults")
      Dim ftpServerElement As ConfigurationElement = siteDefaultsElement.GetChildElement("ftpServer")

      Dim securityElement As ConfigurationElement = ftpServerElement.GetChildElement("security")
      Dim commandFilteringElement As ConfigurationElement = securityElement.GetChildElement("commandFiltering")
      Dim commandFilteringCollection As ConfigurationElementCollection = commandFilteringElement.GetCollection
      Dim addElement As ConfigurationElement = commandFilteringCollection.CreateElement("add")
         addElement("command") = "SYST"
         addElement("allowed") = False
         commandFilteringCollection.Add(addElement)
      Dim sslElement As ConfigurationElement = securityElement.GetChildElement("ssl")
         sslElement("controlChannelPolicy") = "SslAllow"
         sslElement("dataChannelPolicy") = "SslAllow"
         sslElement("serverCertHash") = "57686f6120447564652c2049495320526f636b73"
      Dim authenticationElement As ConfigurationElement = securityElement.GetChildElement("authentication")
      Dim anonymousAuthenticationElement As ConfigurationElement = authenticationElement.GetChildElement("anonymousAuthentication")
         anonymousAuthenticationElement("enabled") = False
      Dim basicAuthenticationElement As ConfigurationElement = authenticationElement.GetChildElement("basicAuthentication")
         basicAuthenticationElement("enabled") = False
      Dim clientCertAuthenticationElement As ConfigurationElement = authenticationElement.GetChildElement("clientCertAuthentication")
         clientCertAuthenticationElement("enabled") = False
      Dim sslClientCertificatesElement As ConfigurationElement = securityElement.GetChildElement("sslClientCertificates")
         sslClientCertificatesElement("clientCertificatePolicy") = "CertIgnore"
      Dim customAuthenticationElement As ConfigurationElement = authenticationElement.GetChildElement("customAuthentication")
      Dim providersCollection As ConfigurationElementCollection = customAuthenticationElement.GetCollection("providers")
      Dim addElement1 As ConfigurationElement = providersCollection.CreateElement("add")
         addElement1("name") = "FtpCustomAuthenticationModule"
         addElement1("enabled") = False
         providersCollection.Add(addElement1)

      serverManager.CommitChanges()
   End Sub

JavaScript

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

var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
var siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults");
var ftpServerElement = siteDefaultsElement.ChildElements.Item("ftpServer");

var securityElement = ftpServerElement.ChildElements.Item("security");
var commandFilteringElement = securityElement.ChildElements.Item("commandFiltering");
var commandFilteringCollection = commandFilteringElement.Collection;
var addElement = commandFilteringCollection.CreateNewElement("add");
   addElement.Properties.Item("command").Value = "SYST";
   addElement.Properties.Item("allowed").Value = false;
   commandFilteringCollection.AddElement(addElement);
var sslElement = securityElement.ChildElements.Item("ssl");
   sslElement.Properties.Item("controlChannelPolicy").Value = "SslAllow";
   sslElement.Properties.Item("dataChannelPolicy").Value = "SslAllow";
   sslElement.Properties.Item("serverCertHash").Value = "57686f6120447564652c2049495320526f636b73";
var authenticationElement = securityElement.ChildElements.Item("authentication");
var anonymousAuthenticationElement = authenticationElement.ChildElements.Item("anonymousAuthentication");
   anonymousAuthenticationElement.Properties.Item("enabled").Value = false;
var basicAuthenticationElement = authenticationElement.ChildElements.Item("basicAuthentication");
   basicAuthenticationElement.Properties.Item("enabled").Value = false;
var clientCertAuthenticationElement = authenticationElement.ChildElements.Item("clientCertAuthentication");
   clientCertAuthenticationElement.Properties.Item("enabled").Value = false;
var sslClientCertificatesElement = securityElement.ChildElements.Item("sslClientCertificates");
    sslClientCertificatesElement.Properties.Item("clientCertificatePolicy").Value = "CertIgnore";
var customAuthenticationElement = authenticationElement.ChildElements.Item("customAuthentication");
var providersCollection = customAuthenticationElement.ChildElements.Item("providers").Collection;
var addElement1 = providersCollection.CreateNewElement("add");
   addElement1.Properties.Item("name").Value = "FtpCustomAuthenticationModule";
   addElement1.Properties.Item("enabled").Value = false;
   providersCollection.AddElement(addElement1);

adminManager.CommitChanges();

VBScript

Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST")
Set siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults")
Set ftpServerElement = siteDefaultsElement.ChildElements.Item("ftpServer")

Set securityElement = ftpServerElement.ChildElements.Item("security")
Set commandFilteringElement = securityElement.ChildElements.Item("commandFiltering")
Set commandFilteringCollection = commandFilteringElement.Collection
Set addElement = commandFilteringCollection.CreateNewElement("add")
   addElement.Properties.Item("command").Value = "SYST"
   addElement.Properties.Item("allowed").Value = False
   commandFilteringCollection.AddElement(addElement)
Set sslElement = securityElement.ChildElements.Item("ssl")
   sslElement.Properties.Item("controlChannelPolicy").Value = "SslAllow"
   sslElement.Properties.Item("dataChannelPolicy").Value = "SslAllow"
   sslElement.Properties.Item("serverCertHash").Value = "57686f6120447564652c2049495320526f636b73"
Set authenticationElement = securityElement.ChildElements.Item("authentication")
Set anonymousAuthenticationElement = authenticationElement.ChildElements.Item("anonymousAuthentication")
   anonymousAuthenticationElement.Properties.Item("enabled").Value = False
Set basicAuthenticationElement = authenticationElement.ChildElements.Item("basicAuthentication")
   basicAuthenticationElement.Properties.Item("enabled").Value = False
Set clientCertAuthenticationElement = authenticationElement.ChildElements.Item("clientCertAuthentication")
   clientCertAuthenticationElement.Properties.Item("enabled").Value = False
Set sslClientCertificatesElement = securityElement.ChildElements.Item("sslClientCertificates")
   sslClientCertificatesElement.Properties.Item("clientCertificatePolicy").Value = "CertIgnore"
Set customAuthenticationElement = authenticationElement.ChildElements.Item("customAuthentication")
Set providersCollection = customAuthenticationElement.ChildElements.Item("providers").Collection
Set addElement1 = providersCollection.CreateNewElement("add")
   addElement1.Properties.Item("name").Value = "FtpCustomAuthenticationModule"
   addElement1.Properties.Item("enabled").Value = False
   providersCollection.AddElement(addElement1)

adminManager.CommitChanges()