<system.ftpServer>

Overview

The <system.ftpServer> element specifies the global-level and URL-level configuration settings for FTP 7 in the ApplicationHost.config file, and contains configuration elements that define the settings that are used by the FTP service.

Note

Unlike settings that are found in the <system.webServer> element, settings in the <system.ftpServer> element cannot be delegated.

Compatibility

Version Notes
IIS 10.0 The <system.ftpServer> element was not modified in IIS 10.0.
IIS 8.5 The <system.ftpServer> element was not modified in IIS 8.5.
IIS 8.0 The <system.ftpServer> element was not modified in IIS 8.0.
IIS 7.5 The <system.ftpServer> element ships as a feature of IIS 7.5.
IIS 7.0 The <system.ftpServer> element was introduced in FTP 7.0, which was a separate download for IIS 7.0.
IIS 6.0 The <system.ftpServer> element and its child elements replace the IIS 6.0 FTP settings that were located in the LM/MSFTPSVC metabase path.

Note

The FTP 7.0 and FTP 7.5 services shipped out-of-band for IIS 7.0, which required downloading and installing the modules from the following URL:

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

With Windows 7 and Windows Server 2008 R2, the FTP 7.5 service ships as a feature for IIS 7.5, so downloading the FTP service is no longer necessary.

Setup

To support FTP publishing for your Web server, you must install the FTP service. To do so, use the following steps.

Windows Server 2012 or Windows Server 2012 R2

  1. On the taskbar, click Server Manager.

  2. In Server Manager, click the Manage menu, and then click Add Roles and Features.

  3. In the Add Roles and Features wizard, click Next. Select the installation type and click Next. Select the destination server and click Next.

  4. On the Server Roles page, expand Web Server (IIS), and then select FTP Server.

    Note

    To support ASP.Membership authentication or IIS Manager authentication for the FTP service, you will need to select FTP Extensibility, in addition to FTP Service.

    Screenshot of Roles menu expanded. F T P Extensibility is highlighted. .

  5. Click Next, and then on the Select features page, click Next again.

  6. On the Confirm installation selections page, click Install.

  7. On the Results page, click Close.

Windows 8 or Windows 8.1

  1. On the Start screen, move the pointer all the way to the lower left corner, right-click the Start button, and then click Control Panel.

  2. In Control Panel, click Programs and Features, and then click Turn Windows features on or off.

  3. Expand Internet Information Services, and then select FTP Server.

    Note

    To support ASP.Membership authentication or IIS Manager authentication for the FTP service, you will also need to select FTP Extensibility.

    Screenshot of Windows Features dialog box with F T P Extensibility highlighted in the expanded menu.

  4. Click OK.

  5. Click Close.

Windows Server 2008 R2

  1. On the taskbar, click Start, point to Administrative Tools, and then click Server Manager.

  2. In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS).

  3. In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services.

  4. On the Select Role Services page of the Add Role Services Wizard, expand FTP Server.

  5. Select FTP Service.

    Note

    To support ASP.Membership authentication or IIS Manager authentication for the FTP service, you will also need to select FTP Extensibility.

    Screenshot of the Add Role Services page with F T P Service highlighted in the expanded menu.

  6. Click Next.

  7. On the Confirm Installation Selections page, click Install.

  8. On the Results page, click Close.

Windows 7

  1. On the taskbar, click Start, and then click Control Panel.

  2. In Control Panel, click Programs and Features, and then click Turn Windows Features on or off.

  3. Expand Internet Information Services, and then FTP Server.

  4. Select FTP Service.

    Note

    To support ASP.Membership authentication or IIS Manager authentication for the FTP service, you will also need to select FTP Extensibility.

    Screenshot of Windows Features dialog box with the o k button highlighted.

  5. Click OK.

Windows Server 2008 or Windows Vista

  1. Download the installation package from the following URL:

  2. Follow the instructions in the following walkthrough to install the FTP service:

How To

How to configure site-level or server-level logging for the FTP service

  1. Open Internet Information Services (IIS) Manager:

    • If you are using Windows Server 2012 or Windows Server 2012 R2:

      • On the taskbar, click Server Manager, click Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows 8 or Windows 8.1:

      • Hold down the Windows key, press the letter X, and then click Control Panel.
      • Click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
    • If you are using Windows Server 2008 or Windows Server 2008 R2:

      • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows Vista or Windows 7:

      • On the taskbar, click Start, and then click Control Panel.
      • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
  2. In the Connections pane, click the server name.

  3. In the Home pane, double-click the FTP Logging feature.
    Screenshot of the I I S Manager Home pane. The F T P Logging feature is highlighted.

  4. In the One log file per drop-down list, choose one of the following options:

    • Choose Site to specify that each FTP site will write to individual log files.
    • Choose Server to specify a single log file for all of your FTP sites.
      Screenshot of the I I S Manager F T P Logging tab.
  5. In the Actions pane, click Apply.

Configuration

Settings in the <system.ftpServer> element can be configured at the global level, site level, and per URL.

Attributes

None.

Child Elements

Element Description
log Optional element.

Specifies the global log settings for the FTP service.
firewallSupport Optional element.

Specifies the port range that the FTP service will use for data channel communication.
providerDefinitions Optional element.

Specifies the collection of custom FTP providers.
security Optional element.

Specifies the security-related settings for FTP.
caching Optional element.

Specifies the credential cache settings for the FTP service.
serverRuntime Optional element.

Specifies settings that configure how the FTP service operates.

Configuration Sample

The following sample illustrates several configuration settings in the global <system.ftpServer> element for a server. More specifically, the settings in this example demonstrate how to:

  • Enable FTP credential caching and specify a time-out of 10 minutes (600 seconds.)

  • Configure the low port as 5000 and the high port as 6000 for data channel communications.

  • Enable logging and specify that log files will be kept per-site, and that log files will be rotated daily by UTC time.

  • Specify a custom FTP provider and specify a custom parameter for that provider.

  • Specify global IP restrictions that allow FTP access from local host and deny access to the 169.254.0.0 to 169.254.255.255 block of IP addresses.

  • Configure request filtering with the following options:

    • Block FTP access to the _vti_bin virtual directory, which is used with the FrontPage Server Extensions.
    • Block several file types that are associated with executables.
    • Specify 100MB as the maximum file size.
  • Add a global authorization rule that allows access for the administrators group.

  • Specify that domain name syntax can be used for FTP virtual host names.

<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>

Sample Code

The following examples add two FTP authorization rules for the Default Web Site. The first rule allows read and write access for the administrators group, and the second rule denies read and write access for the guest account.

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

You must be sure to set the commit parameter to apphost when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.

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()

The following examples configure the <serverRuntime> element for an FTP server to allow domain name syntax for FTP virtual host names.

AppCmd.exe

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

Note

You must be sure to set the commit parameter to apphost when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.

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()