Using Server-to-Server FTP Transfer

Another new feature of IIS 6 is that you can actually control the transfer of files between two FTP servers from another computer, typically an administrator’s workstation. Before I explain this, I should note that for security reasons (FTP passes all credentials in clear text), you shouldn’t perform this task when the transfer must take place over an Internet connection.

To illustrate this, I have two FTP servers set up, both with Default FTP Sites configured on them as follows:

  • Server A has IP address 172.16.11.210.

  • Server B has IP address 172.16.11.220.

Furthermore, files are going to be transferred from Server A to Server B. Specifically, a file named test.txt resides in the home directory on Server A, and your job will be to transfer it to Server B using an FTP session initiated on Workstation C. First, you have to change a Registry setting on each server to enable the transfer to be performed. On Server A, open Registry Editor and find the following key:

HKLM\System\CurrentControlSet\Services\MSFTPSVC\Parameters

Create a DWORD value named EnableDataConnTo3rdIP with a data value of 1. Then go to Server B and create a DWORD value named EnablePasvConnFrom3rdIP in the same location and give it the same data value of 1. Finally, open IIS Manager on Server B, switch to the Home Directory tab, and enable Write permission so files can be uploaded to the server.

You’re ready—switch to Workstation C and let’s do some rather esoteric FTP work. Open up two command prompts, one for an FTP session with Server A and another for an FTP session with Server B. For simplicity, I’ve combined the two sessions here to show the order in which commands need to be issued, and the session with Server B is in italics:

C:\>ftp 172.16.11.210 Connected to 172.16.11.210. 220 Microsoft FTP Service User (172.16.11.210:(none)): anonymous 331 Anonymous access allowed, send identity (e-mail name) as password. Password: 230 Anonymous user logged in. 

Session A (the session with Server A) has been established. Note that I have anonymous authentication enabled on my FTP servers, so I can actually perform the whole transfer as an anonymous user—not very secure; but I’m not covering IIS security until Chapter 10, so we won’t worry about it for now.

 c:\>ftp 172.16.11.220 Connected to 172.16.11.220. 220 Microsoft FTP Service User (172.16.11.220:(none)): anonymous 331 Anonymous access allowed, send identity (e-mail name) as password. Password: 230 Anonymous user logged in. 

Session B has now been established.

 ftp> literal pasv 227 Entering Passive Mode (172,16,11,220,15,118). 

This command requests that Server B open a data port and wait for a connection (instead of initiating one upon receipt of a transfer command). The numbers in brackets represent the IP address and listening data port of Server B. I now need to open this same port from Server A:

ftp> literal port 172,16,11,220,15,118 200 PORT command successful.

This command tells Server A what data port Server B is listening on.

ftp> literal retr test.txt 150 Opening ASCII mode data connection for test.txt (22 bytes).

This begins the file transfer from Server A to Server B.

 ftp> literal stor test.bin 125 Data connection already open; Transfer starting. 

This tells Server B to accept the file transfer being initiated by Server A.

 ftp> literal stat 226 Transfer complete. 

This checks the status of the file transfer, and you can see that it has been completed. If I now right-click the Default FTP Site on Server B and select Browse, I can see that the file test.txt has indeed been transferred.

Note 

For more information about literal, pasv, port, retr, stor, stat, and other esoteric FTP commands, see RFC 959 on the RFC Editor at www.rfc-editor.org.

start sidebar
Challenge

You are a small ISP and plan to use IIS 6 as the web hosting platform for your customers. Users will be assigned home directories and will be able to FTP their web pages to these directories to create personal websites. What feature of FTP on IIS 6 simplifies your job? What kind of directory structure will you plan for your web and FTP site directories? What URL would a user open to access their personal website?

end sidebar




IIS 6 Administration
IIS 6 Administration
ISBN: 0072194855
EAN: 2147483647
Year: 2003
Pages: 131
Authors: Mitch Tulloch

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net