How to perform a server-to-server FTP transfer by using IIS
This article was previously published under Q247132
We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 7.0 running on Microsoft Windows Server 2008. IIS 7.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:
This step-by-step article describes how to configure a computer that is running Microsoft Internet Information Services (IIS) to allow server-to-server FTP transfers by modifying values in the system registry.
Note By default, these values are disabled to prevent malicious attacks against the file transfer protocol (FTP) service. Although details for configuring server-to-server transfers are listed in this article, Microsoft does not recommend modifying these registry keys on IIS-based FTP servers that are connected to the Internet.
RequirementsThe following list outlines the recommended hardware, software, network infrastructure, and service packs that are required:
- Two computers that are running the IIS FTP Service, with the configured changes that are described in the "Server Configuration" section.
- A third computer with the command-line FTP that is included with Microsoft Windows 95, Microsoft Windows 98, Microsoft Windows Millennium Edition (Me), Microsoft Windows NT, and Microsoft Windows 2000, or another FTP client that supports issuing literal FTP commands.
Server configurationImportant This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows
- On the server that initiates the data channel, set the following value in the registry to allow server-to-server FTP transfers when you issue commands from a client that is not located on either of the two FTP servers:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFTPSVC\Parameters\EnableDataConnTo3rdIP=1
- On the second server, set the following value in the registry:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFTPSVC\Parameters\EnablePasvConnFrom3rdIP=1
- Set the following value in the registry on both FTP servers to allow server-to-server FTP transfers when you issue commands from a client that is not located on either of the two FTP servers:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFTPSVC\Parameters\EnablePortAttack = 1
- Set the following value in the registry on the server that will issue the literal port command (Client1 in the example):Note By default, this value does not exist in the registry, and it requires Windows 2000 Service Pack 1 (SP1) or later to be recognized.HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFTPSVC\Parameters\EnablePASVTheft = 1
- Set the following value in the registry on the server that will issue the literal port command (Client1 in the example) to allow server-to-server FTP transfers when you issue commands from a client that is not located on either of the two FTP servers:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFTPSVC\Parameters\EnablePortAttack = 1
- If you are using IIS 4.0 computers that are running Windows NT 4.0 Service Pack 6a or earlier, install the fix that is described in the following Microsoft Knowledge Base article to allow the EnablePortAttack registry key to function properly:246173 FTP server does not allow FTP server-to-server connection
ExampleIn typical client/server FTP transfers, the user is only responsible for sending "friendly" commands to the server; the client responds automatically. When a server-to-server FTP transfer is performed, another server is the client. Therefore, the user is responsible for sending all FTP commands to both servers (in RFC959 format, these are preceded by the "literal" keyword).
To transfer a binary file (named myFile.xls) from Server1 (IP address: 192.168.0.10) to Server2 (IP address: 192.168.1.20) by using the command-line FTP client on Workstation1, follow these steps:
Note You must have Write permissions enabled on Server2 for this example to work.
- Connect to Server1 by using a command-line FTP client. (This connection will be referred to as Client1).
- Connect to Server2 by using a command-line FTP client. (This connection will be referred to as Client2).
- Issue the following command in Client2: literal pasvThe response is as follows:227 Entering Passive Mode (192,168,1,20,15,61)Note that 15,61 represents the low and high order bytes of the port number (port 3901 in this case), which is randomly assigned with each FTP connection. As a result, the last two numbers of this string are different.
- Issue the following command in Client1: literal port 192,168,1,20,15,61The response is as follows:200 Port Command SuccessfulUse the IP and port string that is returned in step 3.
- Issue the following command in both Client1 and Client2: literal type iThe response is as follows:200 Type set to I
- Issue the following command in Client1: literal retr myFile.xlsThe response is as follows:125 Data Connection already open; Transfer Starting
- Issue the following command in Client2: literal stor myFile.xlsThe response is as follows:Opening BINARY mode data connection for myFile.xls
- Continue to issue the following command on Client2 until you receive a 211 "No data connection" response message: literal statThis 211 response message is several lines long and indicates that the transfer is no longer in progress.
For more information about server-to-server FTP transfers in IIS 6.0, visit the following Microsoft TechNet Web site:
For more information about the FTP Bounce attack, click the following article number to view the article in the Microsoft Knowledge Base:
185378 IIS 4.0: FTP "Bounce" attack and CERT Advisory CA-97.27For more information about the registry keys that are listed in this article, click the following article number to view the article in the Microsoft Knowledge Base:
260934 IIS answers PASV commands with port numbers in sequential orderFor more information about how to enhance IIS security, click the following article number to view the article in the Microsoft Knowledge Base:
282060 Resources for securing Internet Information ServicesFor more information about the FTP service that is included with IIS, click the following article number to view the article in the Microsoft Knowledge Base:
283679 Information about the IIS File Transmission Protocol (FTP) serviceFor more information about port, pasv, stor, retr, stat, and other literal FTP commands, visit the following World Wide Web Consortium (W3C) Web site:
RFC 959 - FILE TRANSFER PROTOCOL (FTP)
Article ID: 247132 - Last Review: 07/07/2008 21:26:21 - Revision: 4.1
Microsoft Internet Information Services 6.0, Microsoft Internet Information Services 5.0, Microsoft Internet Information Server 4.0
- kbhowtomaster KB247132