Windows 2025
Sponsored Link

FTP Server : Configure Passive Mode2024/12/19

 

On this example, it shows to configure FTP Server with Passive Mode.

[1] Run PowerShell with Admin Privilege and Configure FTP Service.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# set the port range you use for passive mode
# specify any range that FTP Server Host does not use
# example below sets 60000 - 60100 range
PS C:\Users\Administrator> Set-WebConfiguration "/system.ftpServer/firewallSupport" -PSPath "IIS:\" -Value @{lowDataChannelPort="60000";highDataChannelPort="60100";} 

# confirm
PS C:\Users\Administrator> Get-IISConfigSection -SectionPath "system.ftpServer/firewallSupport" 

IsLocked              : False
OverrideMode          : Inherit
OverrideModeEffective : Deny
SectionPath           : system.ftpServer/firewallSupport
Attributes            : {lowDataChannelPort, highDataChannelPort}
ChildElements         : {}
ElementTagName        : system.ftpServer/firewallSupport
IsLocallyStored       : True
Methods               :
RawAttributes         : {[lowDataChannelPort, 60000], [highDataChannelPort, 60100]}
Schema                : Microsoft.Web.Administration.ConfigurationElementSchema

# restart FTP Service
PS C:\Users\Administrator> Restart-Service ftpsvc 

# no action is required for Windows firewall as predefined settings exist
PS C:\Users\Administrator> Get-NetFirewallRule -DisplayName "FTP*" | Select Name 

Name
----
IIS-WebServerRole-FTP-In-TCP-990
IIS-WebServerRole-FTP-Out-TCP-20
IIS-WebServerRole-FTP-Out-TCP-989
IIS-WebServerRole-FTP-In-TCP-21
IIS-WebServerRole-FTP-Passive-In-TCP

PS C:\Users\Administrator> Get-NetFirewallRule -Name "IIS-WebServerRole-FTP-In-TCP-21" | Get-NetFirewallPortFilter 


Protocol      : TCP
LocalPort     : 21
RemotePort    : Any
IcmpType      : Any
DynamicTarget : Any

PS C:\Users\Administrator> Get-NetFirewallRule -Name "IIS-WebServerRole-FTP-Passive-In-TCP" | Get-NetFirewallPortFilter 


Protocol      : TCP
LocalPort     : 1024-65535
RemotePort    : Any
IcmpType      : Any
DynamicTarget : Any
FTP Server : Configure Passive Mode (GUI)
 

On GUI configuration, set like follows.

[2] Run [Start] - [Server Manager] and Click [Tools] - [Internet Information Services (IIS) Manager].
[3] Select Hostname on the left pane and Click [FTP Firewall Support] on the center pane.
[4] Input port range for [Data Channel Port Range] section. Specify any range that FTP Server Host does not use. (example below sets 60000 - 60100 range)
[5] Open [Server Manager] - [Tools] - [Services] and restart FTP Service to apply changes.
[6] For Windows Firewall, there is a predefined rule for FTP, so there is no need to add a new rule.
Matched Content