Valores predeterminados de nivel de sitio de FTP <ftpServer>
Información general
El elemento <ftpServer>
del elemento <siteDefaults>
especifica la configuración predeterminada para las características de FTP para todos los sitios FTP.
En IIS 6.0, los valores del servicio FTP se almacenaban en una sección independiente de la metabase a los sitios web. En IIS 7 y versiones posteriores, los valores de FTP se almacenan en el archivo ApplicationHost.config dentro de los mismos elementos <site>
y <siteDefaults>
que almacenan los valores de los sitios web. Por este motivo, los valores especificados en el elemento <ftpServer>
no se pueden delegar ni especificar dentro de elementos <location>
.
Nota:
Los valores de FTP adicionales se almacenan en la sección <system.ftpServer>
del archivo ApplicationHost.config y estos valores se especifican en elementos <location>
.
Compatibilidad
Versión | Notas |
---|---|
IIS 10.0 | El elemento <ftpServer> no se modificó en IIS 10.0. |
IIS 8.5 | El elemento <ftpServer> no se modificó en IIS 8.5. |
IIS 8.0 | El elemento <ftpServer> no se modificó en IIS 8.0. |
IIS 7.5 | El elemento <ftpServer> se incluye como una característica de IIS 7.5. |
IIS 7.0 | El elemento <ftpServer> se introdujo en FTP 7.0, que era una descarga independiente para IIS 7.0. |
IIS 6,0 | El elemento <ftpServer> y sus elementos secundarios reemplazan los valores FTP de IIS 6.0 que se encontraban en la ruta de acceso de metabase LM/MSFTPSVC. |
Nota:
Los servicios FTP 7.0 y FTP 7.5 se enviaron fuera de banda para IIS 7.0, lo que requería descargar e instalar el servicio desde la siguiente dirección URL:
Con Windows 7 y Windows Server 2008 R2, el servicio FTP 7.5 se incluye como característica para IIS 7.5, por lo que la descarga del servicio FTP ya no es necesaria.
Configuración
Para admitir la publicación de FTP para el servidor web, debe instalar el servicio FTP. Para ello, siga estos pasos.
Windows Server 2012 o Windows Server 2012 R2
En la barra de tareas, haga clic en Administrador del servidor.
En Administrador del servidor, haga clic en el menú Administrar y, después, haga clic en Agregar roles y características.
En el asistente para Agregar roles y características, haga clic en Siguiente. Seleccione el tipo de instalación y haga clic en Siguiente. Seleccione el servidor de destino y haga clic en Siguiente.
En la página Roles de servidor, expanda Servidor web (IIS) y, después, seleccione Servidor FTP.
Nota:
Para admitir la autenticación ASP.Membership o la autenticación del Administrador de IIS para el servicio FTP, también deberá seleccionar Extensibilidad de FTP, además de Servicio FTP.
.Haga clic en Siguiente y, después, en la página Seleccionar características, vuelva a hacer clic en Siguiente.
En la página Confirmar selecciones de instalación, haga clic en Instalar.
En la página Resultados , haga clic en Cerrar.
Windows 8 o Windows 8.1
En la pantalla Inicio, mueva el puntero hasta la esquina inferior izquierda, haga clic con el botón derecho en el botón Inicio y, a continuación, haga clic en Panel de control.
En Panel de control, haga clic en Programas y características y después en Activar o desactivar las características de Windows.
Expanda Internet Information Services y, después, seleccione Servidor FTP.
Nota:
Para admitir la autenticación ASP.Membership o la autenticación del Administrador de IIS para el servicio FTP, también deberá seleccionar Extensibilidad de FTP.
Haga clic en OK.
Haga clic en Cerrar.
Windows Server 2008 R2
En la barra de tareas, haga clic en Inicio, seleccione Herramientas administrativas y, luego, haga clic en Administrador del servidor.
En el panel de jerarquía del Administrador del servidor, expanda Roles y, luego, haga clic en Servidor web (IIS).
En el panel Servidor web (IIS), desplácese hasta la sección Servicios de rol y, luego, haga clic en Agregar servicios de rol.
En la página Seleccionar servicios de rol del Asistente para agregar servicios de rol, expanda Servidor FTP.
Seleccione Servicio FTP.
Nota:
Para admitir la autenticación ASP.Membership o la autenticación del Administrador de IIS para el servicio FTP, también deberá seleccionar Extensibilidad de FTP.
Haga clic en Next.
En la página Confirmar selecciones de instalación, haz clic en Instalar.
En la página Resultados , haga clic en Cerrar.
Windows 7
En la barra de tareas, haga clic en Inicio y, luego, haga clic en Panel de control.
En Panel de control, haga clic en Programas y características y después en Activar o desactivar las características de Windows.
Expanda Internet Information Services y, luego, Servidor FTP.
Seleccione Servicio FTP.
Nota:
Para admitir la autenticación ASP.Membership o la autenticación del Administrador de IIS para el servicio FTP, también deberá seleccionar Extensibilidad de FTP.
Haga clic en OK.
Windows Server 2008 o Windows Vista
Descargue el paquete de instalación desde la siguiente dirección URL:
Siga las instrucciones del siguiente tutorial para instalar el servicio FTP:
Procedimientos
Habilitación o deshabilitación de la configuración predeterminada de autenticación anónima de FTP
Abra el Administrador de Internet Information Services (IIS):
Si usa Windows Server 2012 o Windows Server 2012 R2:
- En la barra de tareas, haga clic en Administrador del servidor, en Herramientas y, a continuación, en Administrador de Internet Information Services (IIS).
Si usa Windows 8 o Windows 8.1:
- Mantenga presionada la tecla Windows, presione la letra X y haga clic en Panel de control.
- En Panel de control, haga clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
Si usa Windows Server 2008 o Windows Server 2008 R2:
- En la barra de tareas, haga clic en Inicio, seleccione Herramientas administrativas y, a continuación, haga clic en Administrador de Internet Information Services (IIS).
Si usa Windows Vista o Windows 7:
- En la barra de tareas, haga clic en Inicio y, luego, haga clic en Panel de control.
- Haga doble clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
En el panel Conexiones, haga clic en el nombre del servidor.
En el panel Inicio del servidor, haga doble clic en la característica Autenticación FTP.
En la página Autenticación FTP, seleccione Autenticación anónima.
En el panel Acciones, haga clic en Habilitar para habilitar la autenticación anónima, o bien haga clic en Deshabilitar para deshabilitarla.
Habilitación o deshabilitación de la configuración predeterminada de autenticación básica de FTP
Abra el Administrador de Internet Information Services (IIS):
Si usa Windows Server 2012 o Windows Server 2012 R2:
- En la barra de tareas, haga clic en Administrador del servidor, en Herramientas y, a continuación, en Administrador de Internet Information Services (IIS).
Si usa Windows 8 o Windows 8.1:
- Mantenga presionada la tecla Windows, presione la letra X y haga clic en Panel de control.
- En Panel de control, haga clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
Si usa Windows Server 2008 o Windows Server 2008 R2:
- En la barra de tareas, haga clic en Inicio, seleccione Herramientas administrativas y, a continuación, haga clic en Administrador de Internet Information Services (IIS).
Si usa Windows Vista o Windows 7:
- En la barra de tareas, haga clic en Inicio y, luego, haga clic en Panel de control.
- Haga doble clic en Herramientas administrativas y, a continuación, haga doble clic en Administrador de Internet Information Services (IIS).
En el panel Conexiones, haga clic en el nombre del servidor.
En el panel Inicio del servidor, haga doble clic en la característica Autenticación FTP.
En la página Autenticación FTP, seleccione Autenticación básica.
En el panel Acciones, haga clic en Habilitar para habilitar la autenticación básica, o bien haga clic en Deshabilitar para deshabilitarla.
Configuración
El elemento predeterminado <ftpServer>
está configurado en el nivel <siteDefaults>
.
Atributos
Atributo | Descripción |
---|---|
allowUTF8 |
Atributo Boolean opcional. true si UTF8 está habilitado; de lo contrario es false. El valor predeterminado es true . |
serverAutoStart |
Atributo Boolean opcional. true si IIS debe iniciar automáticamente el sitio FTP cuando se inicia el servicio FTP; de lo contrario es false. El valor predeterminado es true . |
Elementos secundarios
Elemento | Descripción |
---|---|
connections |
Elemento opcional. Especifica la configuración predeterminada específica de la conexión para los sitios FTP. |
security |
Elemento opcional. Especifica la configuración predeterminada relacionada con la seguridad para los sitios FTP. |
customFeatures |
Elemento opcional. Especifica la colección predeterminada de proveedores FTP personalizados que se desarrollaron mediante la extensibilidad de FTP. |
messages |
Elemento opcional. Especifica los mensajes predeterminados relacionados con la conexión que mostrarán los sitios FTP a los clientes FTP. |
fileHandling |
Elemento opcional. Especifica la configuración predeterminada de control de archivos para sitios FTP. |
firewallSupport |
Elemento opcional. Especifica la configuración predeterminada de los sitios FTP necesarios para las conexiones FTP que se realizan a través de un firewall. |
userIsolation |
Elemento opcional. Especifica el comportamiento de búsqueda de directorio principal predeterminado para las conexiones FTP. Por ejemplo, los usuarios se pueden restringir a un directorio principal en función de su nombre de inicio de sesión. |
directoryBrowse |
Elemento opcional. Especifica las opciones de lista de directorios predeterminadas para los sitios FTP. Estos valores afectan a la forma en que el servicio FTP mostrará las listas de directorios a los clientes FTP. |
logFile |
Elemento opcional. Especifica las opciones de registro predeterminadas para los sitios FTP. |
Ejemplo de configuración
En el ejemplo de configuración siguiente se muestra un elemento <siteDefaults>
de ejemplo para un servidor que define varios de los valores predeterminados del sitio FTP.
<siteDefaults>
<logFile logFormat="W3C" directory="%SystemDrive%\inetpub\logs\LogFiles" />
<traceFailedRequestsLogging enabled="true" directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles" />
<ftpServer serverAutoStart="true">
<connections controlChannelTimeout="300" />
<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>
<messages bannerMessage="Welcome!" allowLocalDetailedErrors="true" />
<fileHandling keepPartialUploads="false" />
<firewallSupport externalIp4Address="169.254.10.10" />
<userIsolation mode="None" />
<directoryBrowse showFlags="StyleUnix, DisplayAvailableBytes" />
<logFile period="Daily" enabled="true" />
</ftpServer>
</siteDefaults>
Código de ejemplo
En los ejemplos de código siguientes se muestra cómo establecer varios de los valores predeterminados del sitio FTP.
AppCmd.exe
REM Configure FTP sites to start automatically by default.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.serverAutoStart:"True" /commit:apphost
REM Configure the default control channel time-out for 300 seconds.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.connections.controlChannelTimeout:"300" /commit:apphost
REM Configure the default FTP security options.
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
REM Configure a custom default banner message and local detailed error messages.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.messages.bannerMessage:"Welcome!" /siteDefaults.ftpServer.messages.allowLocalDetailedErrors:"True" /commit:apphost
REM Configure the FTP service to keep partially-uploaded files by default.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.fileHandling.keepPartialUploads:"False" /commit:apphost
REM Configure the default external IP address of a firewall.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.firewallSupport.externalIp4Address:"169.254.10.10" /commit:apphost
REM Specify no user isolation by default.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.userIsolation.mode:"None" /commit:apphost
REM Configure UNIX-style directory listings by default and display the available drive space.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.directoryBrowse.showFlags:"StyleUnix, DisplayAvailableBytes" /commit:apphost
REM Enable logging by default with daily log file rollover.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.logFile.period:"Daily" /siteDefaults.ftpServer.logFile.enabled:"True" /commit:apphost
Nota:
Debe asegurarse de establecer el parámetro de confirmación en apphost
cuando use AppCmd.exe para configurar estas opciones. Esto confirma los valores de configuración en la sección de ubicación adecuada del archivo 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");
// Configure FTP sites to start automatically by default.
ftpServerElement["serverAutoStart"] = true;
// Configure the default control channel time-out for 300 seconds.
ConfigurationElement connectionsElement = ftpServerElement.GetChildElement("connections");
connectionsElement["controlChannelTimeout"] = 300;
// Configure the default FTP security options.
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);
// Configure a custom default banner message and local detailed error messages.
ConfigurationElement messagesElement = ftpServerElement.GetChildElement("messages");
messagesElement["bannerMessage"] = @"Welcome!";
messagesElement["allowLocalDetailedErrors"] = true;
// Configure the FTP service to keep partially-uploaded files by default.
ConfigurationElement fileHandlingElement = ftpServerElement.GetChildElement("fileHandling");
fileHandlingElement["keepPartialUploads"] = false;
// Configure the default external IP address of a firewall.
ConfigurationElement firewallSupportElement = ftpServerElement.GetChildElement("firewallSupport");
firewallSupportElement["externalIp4Address"] = @"169.254.10.10";
// Specify no user isolation by default.
ConfigurationElement userIsolationElement = ftpServerElement.GetChildElement("userIsolation");
userIsolationElement["mode"] = @"None";
// Configure UNIX-style directory listings by default and display the available drive space.
ConfigurationElement directoryBrowseElement = ftpServerElement.GetChildElement("directoryBrowse");
directoryBrowseElement["showFlags"] = @"StyleUnix, DisplayAvailableBytes";
// Enable logging by default with daily log file rollover.
ConfigurationElement logFileElement = ftpServerElement.GetChildElement("logFile");
logFileElement["period"] = @"Daily";
logFileElement["enabled"] = 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 sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")
Dim siteDefaultsElement As ConfigurationElement = sitesSection.GetChildElement("siteDefaults")
Dim ftpServerElement As ConfigurationElement = siteDefaultsElement.GetChildElement("ftpServer")
' Configure FTP sites to start automatically by default.
ftpServerElement("serverAutoStart") = True
' Configure the default control channel time-out for 300 seconds.
Dim connectionsElement As ConfigurationElement = ftpServerElement.GetChildElement("connections")
connectionsElement("controlChannelTimeout") = 300
' Configure the default FTP security options.
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)
' Configure a custom default banner message and local detailed error messages.
Dim messagesElement As ConfigurationElement = ftpServerElement.GetChildElement("messages")
messagesElement("bannerMessage") = "Welcome!"
messagesElement("allowLocalDetailedErrors") = True
' Configure the FTP service to keep partially-uploaded files by default.
Dim fileHandlingElement As ConfigurationElement = ftpServerElement.GetChildElement("fileHandling")
fileHandlingElement("keepPartialUploads") = False
' Configure the default external IP address of a firewall.
Dim firewallSupportElement As ConfigurationElement = ftpServerElement.GetChildElement("firewallSupport")
firewallSupportElement("externalIp4Address") = "169.254.10.10"
' Specify no user isolation by default.
Dim userIsolationElement As ConfigurationElement = ftpServerElement.GetChildElement("userIsolation")
userIsolationElement("mode") = "None"
' Configure UNIX-style directory listings by default and display the available drive space.
Dim directoryBrowseElement As ConfigurationElement = ftpServerElement.GetChildElement("directoryBrowse")
directoryBrowseElement("showFlags") = "StyleUnix, DisplayAvailableBytes"
' Enable logging by default with daily log file rollover.
Dim logFileElement As ConfigurationElement = ftpServerElement.GetChildElement("logFile")
logFileElement("period") = "Daily"
logFileElement("enabled") = True
serverManager.CommitChanges()
End Sub
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 siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults");
var ftpServerElement = siteDefaultsElement.ChildElements.Item("ftpServer");
// Configure FTP sites to start automatically by default.
ftpServerElement.Properties.Item("serverAutoStart").Value = true;
// Configure the default control channel time-out for 300 seconds.
var connectionsElement = ftpServerElement.ChildElements.Item("connections");
connectionsElement.Properties.Item("controlChannelTimeout").Value = 300;
// Configure the default FTP security options.
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);
// Configure a custom default banner message and local detailed error messages.
var messagesElement = ftpServerElement.ChildElements.Item("messages");
messagesElement.Properties.Item("bannerMessage").Value = "Welcome!";
messagesElement.Properties.Item("allowLocalDetailedErrors").Value = true;
// Configure the FTP service to keep partially-uploaded files by default.
var fileHandlingElement = ftpServerElement.ChildElements.Item("fileHandling");
fileHandlingElement.Properties.Item("keepPartialUploads").Value = false;
// Configure the default external IP address of a firewall.
var firewallSupportElement = ftpServerElement.ChildElements.Item("firewallSupport");
firewallSupportElement.Properties.Item("externalIp4Address").Value = "169.254.10.10";
// Specify no user isolation by default.
var userIsolationElement = ftpServerElement.ChildElements.Item("userIsolation");
userIsolationElement.Properties.Item("mode").Value = "None";
// Configure UNIX-style directory listings by default and display the available drive space.
var directoryBrowseElement = ftpServerElement.ChildElements.Item("directoryBrowse");
directoryBrowseElement.Properties.Item("showFlags").Value = "StyleUnix, DisplayAvailableBytes";
// Enable logging by default with daily log file rollover.
var logFileElement = ftpServerElement.ChildElements.Item("logFile");
logFileElement.Properties.Item("period").Value = "Daily";
logFileElement.Properties.Item("enabled").Value = true;
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")
' Configure FTP sites to start automatically by default.
ftpServerElement.Properties.Item("serverAutoStart").Value = True
' Configure the default control channel time-out for 300 seconds.
Set connectionsElement = ftpServerElement.ChildElements.Item("connections")
connectionsElement.Properties.Item("controlChannelTimeout").Value = 300
' Configure the default FTP security options.
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)
' Configure a custom default banner message and local detailed error messages.
Set messagesElement = ftpServerElement.ChildElements.Item("messages")
messagesElement.Properties.Item("bannerMessage").Value = "Welcome!"
messagesElement.Properties.Item("allowLocalDetailedErrors").Value = True
' Configure the FTP service to keep partially-uploaded files by default.
Set fileHandlingElement = ftpServerElement.ChildElements.Item("fileHandling")
fileHandlingElement.Properties.Item("keepPartialUploads").Value = False
' Configure the default external IP address of a firewall.
Set firewallSupportElement = ftpServerElement.ChildElements.Item("firewallSupport")
firewallSupportElement.Properties.Item("externalIp4Address").Value = "169.254.10.10"
' Specify no user isolation by default.
Set userIsolationElement = ftpServerElement.ChildElements.Item("userIsolation")
userIsolationElement.Properties.Item("mode").Value = "None"
' Configure UNIX-style directory listings by default and display the available drive space.
Set directoryBrowseElement = ftpServerElement.ChildElements.Item("directoryBrowse")
directoryBrowseElement.Properties.Item("showFlags").Value = "StyleUnix, DisplayAvailableBytes"
' Enable logging by default with daily log file rollover.
Set logFileElement = ftpServerElement.ChildElements.Item("logFile")
logFileElement.Properties.Item("period").Value = "Daily"
logFileElement.Properties.Item("enabled").Value = True
adminManager.CommitChanges()