The TCP/IP Guide - Version 3.0 (Contents) ` 1348 _ © 2001-2005 Charles M. Kozierok. All Rights Reserved.
FTP Sample User and Internal Command Dialog
The previous two sections have described how FTP operates, and shown the commands
and reply codes used to implement communication between an FTP user and an FTP
server. Having now seen all the details of how FTP works, let's tie everything together by
looking at a sample FTP session between an FTP client and server, to see FTP commands
and replies “in action”.
In this example, I will invoke FTP from a client to retrieve a text file from an FTP server, then
delete the file from the server and the directory that contained it. In the process, I will issue
some additional commands to illustrate more of how FTP works. I will enable “debug” mode
in the FTP client so that for each user command we can see the actual FTP protocol
commands generated.
Table 234 shows the sample FTP dialog, slightly simplified. The first column contains
commands entered by the user (that's me) on the FTP client. The second shows the actual
protocol command(s) sent to the FTP server in highlighted text, and the reply returned from
the server to the client in plain text. The third contains descriptive comments.
Table 234: Sample FTP Session (Page 1 of 3)
User
Command
FTP Protocol Command / FTP Server
Reply
Comments
ftp -d
pcguide.com
Connected to pcguide.com.
220 ftp199.pair.com NcFTPd Server
(licensed copy) ready.
Name (pcguide.com:ixl):
This is the command to start up FTP. The
“-d” enables debug mode. In this initial
step the TCP control connection is made,
and the server replies with a 220 reply
code indicating that it is ready for user
identification. The FTP client automati-
cally prompts for the user name.
ixl
USER ixl
331 User ixl okay, need password.
I use “ixl” for user names commonly. Here,
the FTP client sends the user name and
the server responds back asking for the
password.
****
PASS XXXX
230-You are user #1 of 300 simultaneous
users allowed.
230-
230-
230-Welcome to (<system name>)
230-
230 Logged in.
SYST
215 UNIX Type: L8
Remote system type is UNIX.
Using binary mode to transfer files.
I enter my password, which is sent to the
FTP server, and a bunch of stuff happens.
☺ The server authenticates me and sends
back a 230 message. This tells me the
login was successful. It also provides me
with additional information.
The FTP client then automatically sends a
SYST command to tell me what type of
system the server is using, in this case
UNIX. The client also tells me that binary
mode has been selected by default; this is
often the default when doing FTP from
UNIX to UNIX (as I am doing here) since
there is no need for ASCII mode when
moving text files between similar systems.