-->
Previous Table of Contents Next


Chapter 48
Setting Up an FTP and Anonymous FTP Site

by Tim Parker

In This Chapter
•   What is FTP?
•   Configuring FTP
•   A more secure FTP
•   Protecting an anonymous FTP system

Snap question: What is the most widely used TCP/IP and Internet service? If you answered FTP, you’re right. (If you didn’t choose FTP, this may come as a bit of a surprise. The fact is, FTP remains the most widely used service; although the World Wide Web is quickly catching up.) FTP’s popularity is easy to figure: The FTP software is supplied with every version of UNIX and Linux; it’s easy to install, configure, and use; and it gives users access to a wealth of information with very little effort. Lately, the popularity of the World Wide Web has made a different interface to FTP available: the Web browser. Most browsers such as Netscape Navigator allow you to use it for file transfers to FTP sites.

If all you want to use FTP for is connecting to another machine and transferring files, then you don’t have to do much more than enable the FTP service on your system. Much more interesting to many users is turning your Linux machine into an FTP site, where others can connect and obtain files you make available. That’s the primary focus of this chapter—setting up an FTP site on your Linux machine. We’ll begin, though, with a quick look at using FTP and the way FTP runs on TCP. This information should help you understand how FTP works and what it does with TCP/IP.

What Is FTP?

The File Transfer Protocol (FTP) is one protocol in the TCP/IP family used to transfer files between machines running TCP/IP. (FTP-like programs are also available for some other protocols, too.) The File Transfer Protocol allows you to transfer files back and forth and manage directories. FTP is not designed to allow you access to another machine to execute programs, but it is the best utility for file manipulation. To use FTP, both ends of a connection must be running a program that provides FTP services. The end that starts the connection (the client) calls the other end (the server) and establishes the FTP protocol through a set of handshaking instructions.

Usually, when you connect to a remote system via FTP, you must log in. This means you must be a valid user, with a username and password for that remote machine. Because it is impossible to provide logins for everyone who wants to access a machine that enables anyone to gain access, many systems use “anonymous FTP” instead. Anonymous FTP enables anyone to log in to the system with the login name of “ftp” or “anonymous” with either no password or with an email address for their local system as the password.

Using FTP

Using FTP to connect to a remote site is easy. You have access to the remote machine either through the Internet (directly or through a service provider) or through a local area network if the remote machine is directly reachable. To use FTP, start the FTP client software and provide the name of the remote system you want to connect to. For example, assuming you can get to the remote machine through a LAN or the Internet (which knows about the remote machine thanks to Domain Name Service), issue the following command:


ftp chatton.com

This instructs your FTP software to try to connect to the remote machine chatton.com and establish an FTP session.

When the connection is completed (and assuming the remote system allows FTP logins), the remote prompts for a userID. If anonymous FTP is supported on the system, a message usually tells you exactly that. The following is for the Linux FTP archive site sunsite.unc.edu:


ftp sunsite.unc.edu

331 Guest login ok, send your complete e-mail address as password.

Enter username (default: anonymous): anonymous

Enter password [tparker@tpci.com]:

|FTP| Open

230-    WELCOME to UNC and SUN’s anonymous ftp server

230-      University of North Carolina

230-      Office FOR Information Technology

230-        SunSITE.unc.edu

230 Guest login ok, access restrictions apply.

FTP>

After the login process is completed, you see the prompt FTP> indicating the remote system is ready to accept commands.

When you log on to some systems, you may see a short message that contains instructions for downloading files, any restrictions that are placed on you as an anonymous FTP user, or information about the location of useful files. For example, you may see messages like these (taken from the Linux FTP site):


To get a binary file, type: BINARY and then: GET “File.Name” newfilename

To get a text file, type: ASCII and then: GET “File.Name” newfilename

Names MUST match upper, lower case exactly. Use the “quotes” as shown.

To get a directory, type: DIR. To change directory, type: CD “Dir.Name”

To read a short text file, type: GET “File.Name” TT

For more, type HELP or see FAQ in gopher.

To quit, type EXIT or Control-Z.



230- If you email to info@sunsite.unc.edu you will be sent help

     åinformation

230- about how to use the different services sunsite provides.

230- We use the Wuarchive experimental ftpd. if you “get”

     å<directory>.tar.Z

230- or <file>.Z it will compress and/or tar it on the fly. Using “.gz”

     åinstead

230- of “.Z” will use the GNU zip (/pub/gnu/gzip*) instead, a superior

230- compression method.

After you are logged on to the remote system, you can use familiar Linux commands to display file contents and move around directories. To display the contents of a directory, for example, use the command ls (some systems support the DOS equivalent dir). To change to a subdirectory, use the cd command. To return to the parent directory (the one above the current directory), use the command cd. As you can see, these commands are the same as those you use on your local machine, except you are now navigating on the remote system.

There are no keyboard shortcuts (such as pressing the TAB key to fill in names that match) available with FTP. This means you have to type in the name of files or directories in their entirety (and correctly). If you misspell a file or directory name, you will get error messages and have to try again. Luckily, if you are performing the FTP session through X Window, you can cut and paste lines from earlier in your session.


Previous Table of Contents Next