Configuring the Default FTP Site

Once you’ve installed the FTP Service, it’s easy to start using it because IIS automatically creates a Default FTP Site. Users can immediately use this to upload or download content (see Figure 9-1). Configuring the Default FTP Site is even simpler than configuring the Default Web Site (see Chapter 7, “Creating and Configuring Websites”), since FTP sites have fewer configuration options than websites do. And, like the WWW Service on IIS, the FTP Service can be configured using properties sheets at several levels, though for FTP there are fewer levels than WWW:

click to expand
Figure 9-1: The Default FTP Site in IIS Manager

  • FTP Sites level By right-clicking the FTP Sites node in IIS Manager and selecting Properties, you can open the FTP Sites properties sheet, which allows you to configure settings globally for all FTP sites running on your server.

  • FTP Site level The properties sheet for individual FTP sites like the Default FTP Site lets you configure settings specifically for that site alone.

  • Virtual Directory level The properties sheet for a virtual directory within an FTP site lets you configure settings specifically for that directory alone.

    Note 

    While the WWW Service lets you configure settings at the file level for individual web pages, this is not the case for the FTP Services. In fact, neither files nor physical directories are displayed when you select an FTP site in IIS Manager; only FTP sites and virtual directories are displayed and can be configured.

Just as we did for websites in Chapter 7, we’ll first look at the big picture of how to configure FTP sites and their directories and files. Table 9-1 shows which tabs appear on the properties sheets for each configuration level just described.

Table 9-1: Tabs on IIS Properties Sheets of Different Levels (FTP)

Name of Tab

FTP Sites Level

FTP Site Level

Virtual Directory Level

FTP Site

Ö

Ö

 

Security Accounts

Ö

Ö

 

Messages

Ö

Ö

 

Home Directory

Ö

Ö

Ö*

Directory Security

Ö

Ö

Ö

This tab is called Virtual Directory for virtual directories.

Note 

Like the WWW Service, when you configure FTP settings at higher levels, they are inherited at lower levels; and if you configure settings at lower levels, they override settings at higher levels. Also, if you change a lower-level setting and then try to change the same setting at a higher level, you are prompted to choose whether your higher-level change should overwrite the previously changed lower- level one.

Location of Content

Let’s begin our look at configuring the Default FTP Site by examining the location for storing its content. By default, the home directory for the Default FTP Site is C:\ Inetpub\ftproot, but it can be modified using the Home Directory tab of the Default FTP Site properties sheet (Figure 9-2).

click to expand
Figure 9-2: Specifying the content location for the Default FTP Site

Like websites (covered in Chapter 7), FTP sites can use either a local directory or a network share for the location of their home directory. If a network share is selected, it must be specified as a UNC path, and credentials must be specified for accessing the share. These credentials can be either a specific user account (local or domain user, depending on whether the server is part of a workgroup or domain), or you can use the credentials of the authenticated user (the user running the FTP client and accessing the FTP site on IIS).

Tip 

You can also change the home directory of an FTP site by editing the metabase, as you’ll see in Chapter 14, “Working with the Metabase.”

Take a moment to test your Default FTP Site by creating a text file called test.txt that contains the sentence, “The quick brown fox¼” and placing it in the folder C:\ Inetpub\ftproot. Now, start Internet Explorer on your IIS machine and open the URL ftp://localhost. The test.txt file should be displayed in the browser window (Figure 9-3).

click to expand
Figure 9-3: Testing the Default FTP Site

Tip 

When you select the Default FTP Site in IIS Manager, the file test.txt isn’t displayed in the right pane of the console. However, if you right-click the Default FTP Site and select Browse or Explorer, you can see that the file is indeed there.

Virtual Directories

To make files available to your users for download from the Default FTP Site, simply use Windows Explorer to copy them (or use xcopy from the command line) from wherever the files are currently located to C:\Inetpub\ftproot, the home directory of the Default FTP Site. Alternatively, if the files you want to make available to users are stored in a different directory on the server or on a file server somewhere on your network, you can create a virtual directory within the Default FTP Site and map the alias of this virtual directory to the physical directory or network share where the files are currently stored.

You should be familiar with virtual directories from Chapter 7, so try the following walkthrough. Create a folder C:\moreftp on your IIS machine and create a text file moretest.txt in this directory (this file can contain the sentence “¼jumps over¼,” if you like). Now right-click the Default FTP Site and select New | Virtual Directory to start the Virtual Directory Creation Wizard. Go through the wizard. Specify More for the directory’s alias and C:\moreftp as the physical directory represented by this alias, and leave the directory permissions set at their default Read setting. When the wizard is finished, the new virtual directory is displayed in IIS Manager as expected (Figure 9-4).

click to expand
Figure 9-4: Virtual directory within the Default FTP Site

Accessing Virtual Directories

Now here’s a difference between browsing FTP and websites: when you open the URL ftp://localhost on your machine again after creating the /more virtual directory in the preceding, the contents of your FTP site will still appear to be the same as before (see Figure 9-3 again). Virtual directories don’t show up when browsing an FTP site with Internet Explorer, so users won’t be aware of the virtual directory unless you tell them about it! Once they know about the virtual directory, however, they can display its contents by opening the appropriate URL (on the local IIS machine, this would be ftp://localhost/more).

click to expand
Figure 9-5: Physical directories are displayed in FTP client directory listings.

The same is true for any other FTP client, including the command-line FTP client included in all versions of Windows. Here’s an example of a command-line session on the FTP server with a play-by-play commentary of what’s going on:

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

You’re now logged on to the Default FTP Site as an anonymous user. Now do a directory listing of the FTP site’s home directory using the list (ls) command and see what you find to download:

ftp> ls 200 PORT command successful. 150 Opening ASCII mode data connection for file list. test.txt 226 Transfer complete. ftp: 10 bytes received in 0.00Seconds 10000.00Kbytes/sec. 

Notice that your old file test.txt is sitting there in the root FTP directory of the site, but the /more virtual directory isn’t displayed. It’s there, though, and you can switch to this directory by using the change directory (cd) command:

ftp> cd more 250 CWD command successful.

You’re in the /more virtual directory now (as you’d expect of a virtual directory, it appears like a subdirectory of the FTP site’s root directory), so see what’s in this directory:

ftp> ls 200 PORT command successful. 150 Opening ASCII mode data connection for file list. moretext.txt 226 Transfer complete. ftp: 14 bytes received in 0.00Seconds 14000.00Kbytes/sec.

There’s the moretext.txt file! Grab it and download it to your local system’s current directory C:\, and then do a dir to verify the download worked after you log off from the Default FTP Site and end your FTP client session:

ftp> get moretext.txt 200 PORT command successful. 150 Opening ASCII mode data connection for moretext.txt(17 bytes). 226 Transfer complete. ftp: 17 bytes received in 0.00Seconds 17000.00Kbytes/sec. ftp> close 221 ftp> quit C:\>dir m*  Volume in drive C has no label.  Volume Serial Number is 5CA7-A222  Directory of C:\ 11/04/2002  11:38 PM    <DIR>          management 11/14/2002  06:55 PM    <DIR>          moreftp 11/14/2002  07:15 PM                17 moretext.txt                1 File(s)             17 bytes                2 Dir(s)   4,075,888,640 bytes free C:\> 

Accessing Physical Subdirectories

You’ve seen how virtual directories work in FTP sites, but how about physical directories? Let’s now use Windows Explorer to create the subdirectory C:\Inetpub\ftproot\less, and then create a text file called lesstest.txt that says “¼the lazy dog¼” within the \less directory. Now switch to IIS Manager again and press F5 to refresh the view of the Default FTP Site’s contents. Notice that it still looks exactly like Figure 9-4—in other words, virtual directories of FTP sites are displayed in IIS Manager but physical subdirectories of an FTP site’s home directory are not displayed!

Tip 

However, if you right-click the FTP site and select Browse or Explorer, physical subdirectories and files are displayed in the details pane—but virtual subdirectories are not!!

Now open the URL http://localhost again using IE, and this time notice that the folder \less shows up in the directory listing of the Default FTP Site’s home directory (Figure 9-5). Double-click the \less directory to view the directory’s contents and read or download the file in it. Now, here’s a question for you: what if you ran through the same command-line FTP session you did previously? Would the \less directory show up when you did the first ls of the root directory’s contents?

Other Configuration Tasks

Once you’ve decided on the location of the root or home directory for the Default FTP Site, there are a few other configuration tasks you can perform for the site. Some of these are performed using the properties sheet for the Default FTP Site, while others are performed by right-clicking the node for the site in IIS Manager. We’ll take a look at some of these tasks here, but I’ll defer a discussion of FTP settings relating to security, performance, and maintenance until Chapter 10, “Securing IIS,” Chapter 12, “Performance Tuning and Maintenance,” and Chapter 13, “Maintenance and Troubleshooting.”

Default FTP Site Identity

By modifying the Description field on the FTP Site tab, you can give the site a different “friendly name” than Default FTP Site. Note, however, that this name is only displayed in IIS Manager and is not used for anything else. For the IP address and port settings, as you’d expect, the Default FTP Site has (All Unassigned) as its IP address, and the meaning of this is the same as it was for the Default Web Site as explained in Chapter 7. I’ll talk more about FTP site identity later in this chapter when we discuss how to create additional FTP sites on your server in the section entitled “Creating Additional FTP Sites.”

Directory Listing Style

On the Home Directory tab (refer back to Figure 9-2 again) you can choose between two different directory listing styles: UNIX and MS-DOS. The choice you make here determines the format in which results are displayed when your FTP client issues a list (ls) command. If you have mostly Windows clients accessing your site, leave the setting as MS-DOS, which is the default.

FTP Messages

On the Messages tab (see Figure 9-6), you can specify messages that will be sent to your FTP clients under certain conditions:

  • Banner This message appears when the user tries to access the site but before the user logs on (if anonymous users are allowed to access the site, the banner message will not be displayed).

  • Welcome This message appears immediately after the user logs on to the site.

  • Exit This message appears after the user logs off the site.

  • Maximum Connections This message is displayed when a user tries to access an FTP site that already has the maximum number of users connected to it.

    click to expand
    Figure 9-6: Specifying FTP messages

Here’s a transcript of a command-line FTP session showing how these four messages might work. To make the Maximum Connections message appear, I configured the FTP Site Connections setting on the FTP Site tab to limit the number of client connections to the site to only one connection.

C:\>ftp ftp> open localhost Connected to localhost. 220-Microsoft FTP Service 220 YOU ARE ABOUT TO ENTER MY SITE... 

There’s the Banner message showing up.

User (localhost:(none)): anonymous 331 Anonymous access allowed, send identity (e-mail name) as password. Password: 230-YOU MADE IT IN, CONGRATULATIONS!

And there’s the Welcome message.

230 Anonymous user logged in. ftp> !

The ! (exclamation mark) command temporarily breaks out of the FTP command-line session back to the Windows command interpreter, which gives me the opportunity of trying to open another FTP session with the server.

Microsoft Windows [Version 5.2.3678] (C) Copyright 1985-2002 Microsoft Corp. C:\>ftp ftp> open localhost Connected to localhost. 421 SORRY, I'VE GOT FRIENDS OVER RIGHT NOW. 

There’s the Maximum Connections message as expected.

Connection closed by remote host. ftp> quit C:\>exit

The exit command returns me to my first FTP session.

ftp> close 221 THANKS FOR DROPPING BY!

And there’s the Exit message.

ftp> quit C:\>

Other Tasks

You can stop and start (or pause and resume) FTP sites using IIS Manager. You can also save the metabase configuration of a site to an XML file and import it into a different site or server. These functions work the same way websites do, as we discussed in Chapter 7.




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