Using FTP

This section describes a typical FTP session.

To start an FTP session and connect to an FTP server

  1. Start a command prompt and type the following information:

ftp IPaddress

where IPaddress is a valid IP address. Then press Enter.

Note To test TCP/IP on your computer, you can always use the IP address 127.0.0.1. This address is known as the loopback address for your computer. The loopback address uses loopback drivers to reroute outgoing packets back to the source computer. By going through the loopback drivers, the packets can bypass the network adapter card completely and be returned directly to the computer that is performing the test.

  1. When you are prompted to log on with a user name, log on as Anonymous.
  2. When prompted for a password, press enter. An ftp> prompt appears.

At the ftp> prompt, you can enter FTP commands. Some of the common FTP commands are described in Table 1.9. (For a complete list of FTP client commands, see Appendix A, "TCP/IP Utilities Reference," of the Windows NT Server Resource Kit Networking Guide.)

Table 1.9 Common FTP Commands

Command

Purpose

bye

Ends the FTP session with the remote computer and exits FTP.

delete

Deletes files on the remote computer; requires appropriate permissions.

dir

Lists the remote directory's files and subdirectories.

get

Copies a remote file to your computer.

help

Displays descriptions for FTP commands.

open

Connects to the specified FTP server.

put

Copies a file from your computer to the remote computer; requires appropriate permissions.

mkdir

Creates a directory on the remote computer, requires appropriate permissions.

!

Returns you to the Microsoft MS-DOS® shell. FTP is still active; type exit to return to the >ftp prompt.

!command

Executes an MS-DOS command on the local computer from the FTP session.


For example, to copy a file from the server computer, type the following command at the >ftp prompt.

get filename

This command copies the specified file from the server to the client.

After you enter a command, you receive a series of return codes from the FTP server on a number of lines. The return codes let you know the status of each command. Table 1.10 shows some of the common return codes listed in RFC 640. Information in italics is supplied by the server. (A complete list of return codes in RFC 640 can be found at http://andrew2.andrew.cmu.edu/rfc/rfc640.html.)

Table 1.10 FTP Server Return Codes

Code

Meaning

119

Terminal not available, will try mailbox.

120

Service ready in nnn minutes.

125

Data connection already open; transfer starting.

225

Data connection open; no transfer in progress.

150

File status okay; about to open data connection.

151

User not local; will forward to user@host.

152

User unknown; mail will be forwarded by the operator.

250

Requested file action okay, completed.

200

Command okay.

211

System status, or system help reply.

212

Directory status.

213

File status.

214

Help message.

220

Service ready for new user.

221

Service closing Telnet connection.

226

Closing data connection; requested file action successful (for example, file transfer or file abort).

227

Entering passive mode.

230

User logged in; proceed.

331

User name okay; need password.

332

Need account for login.

350

Requested file action pending further information.

450

Requested file action not taken: file unavailable (for example, file busy).

421

Service not available, closing Telnet connection. This can be a reply to any command if the service must shut down.

425

Cannot open data connection.

426

Connection closed; transfer aborted.

530

Not logged in.

532

Need account for storing files.

550

Requested action not taken.