Sei sulla pagina 1di 5

File T r a n s f e r P r o t o c ol ( F T P )

No t e b o o k: First Notebook
Cre at e d : 12-07-2017 10:42 Up d at e d : 12-07-2017 10:48
A u t h o r: mishrap456@gmail.com

File T r a n s f e r P r o t o c ol ( F T P )

It designed to allow the efficient transfer of files between any two devices on a TCP/IP
internetwork. It automatically takes care of the details of how files are moved, provides a rich
command syntax to allow various supporting file operations to be performed (such as navigating
the directory structure and deleting files), and operates using the Transmission Control Protocol
(TCP) transport service for reliability.

FTP is based on a client/server model, with an FTP client on a user machine creating a connection
to an FTP server to send and retrieve files to and from the server. The main objectives of FTP
were to make file transfer simple and to shield the user from implementation details of how the
files are actually moved from one place to another

To ensure that files are sent and received without loss of data that could corrupt them, FTP uses
the reliable TCP at the transport layer. An authentication system is used to ensure that only
authorized clients are allowed to access a server. At the same time, a feature sometimes called a
n o n y m o u s F T P allows an organization that wishes it to set up a general information server to
provide files to anyone who might want to retrieve them.
After a TCP connection is established, an FTP control connection is created. Internal FTP
commands are passed over this logical connection based on formatting rules established by the
Telnet Protocol. Each command sent by the client receives a reply from the server to indicate
whether it succeeded or failed. A data connection is established for each individual data transfer to
be performed. FTP supports normal and passive data connections, allowing either the server or
client to initiate the data connection.
KEY CONCEPT The FTP client is sometimes called the u s e r d e v ic e , since the human user
interacts with the client directly. The FTP client software is called the u s e r - F T P p r o c e s s ;
the FTP server software is the s e r v e r - F T P p r o c e s s .
F T PC ontr olC onnectionandData C onnection
FTP model is designed around two logical channels of communication between the server and user
FTP processes

Control Connection This is the main logical TCP connection that is created when an FTP session is
established. It is maintained throughout the FTP session and is used only for passing control
information, such as FTP commands and replies. It is not used to send files. Data Connection Each
time data is sent from the server to the client or vice versa,

a distinct TCP data connection is established between them. Data is transferred over this
connection. When the file transfer is complete, the connection is terminated

KEY CONCEPT Unlike most protocols, FTP does not use a single TCP connection. When a session is
set up, a permanent c o n t r ol c o n n e c tio n is established using TCP for passing commands
and replies. When files or other data are to be sent, they are passed over separate TCP d a t a c o
n n e c tio n s that are created and then dismantled as needed.
FTP model divides the software on each device into two logical protocol components that are
responsible for each channel.

The p r o t o c ol in t e r p r e t e r ( P I ) is a piece of software that is charged with managing the


control connection, issuing and receiving commands and replies.
The d a t a t r a n s f e r p r o c e s s ( D T P ) is responsible for actually sending and receiving
data between the client and server
user FTP process includes a third component, a u s e r in t e r f a c e , that interacts with the
human FTP user

Server Protocol Interpreter (Server-PI) The protocol interpreter is responsible for managing the
control connection on the server. It listens on the main reserved
FTP port for incoming connection requests from users (clients). Once a connection is established, it
receives commands from the user-PI, sends back replies, and manages the server data transfer
process. Server Data Transfer Process (Server-DTP) The DTP on the server side is used to send or
receive data to or from the user-DTP. The server-DTP may either establish a data connection or
listen for a data connection coming from the user. It interacts with the servers local file system to
read and write files.
User Protocol Interpreter (User-PI) This protocol interpreter is responsible for managing the control
connection on the client. It initiates the FTP session by issuing a request to the server-PI. Once a
connection is established, it processes commands received from the user interface, sends them to
the server-PI, and receives replies. It also manages the user data transfer process. User Data
Transfer Process (User-DTP) The DTP on the user side sends or receives data to or from the
server-DTP. The user-DTP may either establish a data connection or listen for a data connection
coming from the server. It interacts with the client devices local file system. User Interface The
user interface provides a more friendly FTP interface to a human user. It allows simpler user-
oriented commands to be used for FTP functions rather than the somewhat cryptic internal FTP
commands, and it allows results and information to be conveyed back to the person operating the
FTP session.
FTP Control Connection Establishment, User Authentication, and Anonymous FTP Access You just
saw how FTP uses distinct logical data and control channels that are established between an FTP
client (user) and an FTP server. Before the data connection can be used to send actual files, the
control connection must be established. A specific process is followed to set up this connection and
thereby create the permanent FTP session between devices that can be used for transferring files.
As with other client/server protocols, the FTP server assumes a passive role in the control
connection process. The server protocol interpreter (server-PI) listens on the special well-known
TCP port reserved for FTP control connections: port 21. The user-PI initiates the connection by
opening a TCP connection from the user device to the server on this port. It uses an ephemeral
port number as its source port in the TCP connection. Once TCP has been set up, the control
connection between the devices is established, allowing commands to be sent from the user-PI to
the server-PI and reply codes to be sent back in response. The first order of business after the
channel is operating is u s e r a u t h e n tic a tio n , which the FTP standard calls the lo gin s e q u
e n c e . This process has two purposes: Access Control The authentication process allows access
to the server to be restricted to only authorized users. It also lets the server control what types of
access each user has. Resource Selection By identifying the user making the connection, the FTP
server can make decisions about what resources to make available to the user.
FTP Data Connection Management The control channel created between the server-PI and the
user-PI using the FTP connection establishment and authentication process is maintained
throughout the FTP session. Over the control channel, the protocol interpreters exchange
commands and replies, but not data. Each time files or other data need to be sent between the
server and user FTP processes, a data connection must be created. The data connection links the
userDTP with the server-DTP. This connection is required both for explicit file transfer actions
(getting or receiving a file) and for implFile T r a n s f e r P r o t o c ol ( F T P )icit data transfers,
such as requesting a list of files from a directory on the server. The FTP standard specifies two
different ways of creating a data connection, though it doesnt really explain them in a way that is
very easy to understand. The two methods differ primarily in which devicethe client or the server
initiates the connection. This may at first seem like a trivial matter, but as youll see shortly, it is
actually quite important. N o r m a l ( A c t i v e ) D a t a C o n n e c t i o n s The first method is
sometimes called creating a n o r m a l data connection (because it is the default method) and
sometimes an a c tiv e data connection (in contrast with the passive method we will discuss in a
moment). In this type of connection, the server-DTP initiates the data channel by opening a TCP
connection to the user-DTP. The server uses the special reserved port number 20 (one less than
the well-known control FTP port number 21) for the data connection. On the client machine, the
default port number used is the same as the ephemeral port number used for the control
connection, but as youll see shortly, the client will often choose a different port for each transfer.
Lets use an example to see how this works. Suppose the user-PI established a control connection
from its ephemeral port number 1678 to the servers FTP control port of 21. Then, to create a data
connection for data transfer, the server-PI would instruct the server-DTP to initiate a TCP
connection from the servers port 20 to the clients port 1678. The client would acknowledge this,
and then data could be transferred (in either directionremember that TCP is bidirectional). In
practice, having the clients control and data connection on the same port is not a good idea; it
complicates the operation of FTP and can lead to some tricky problems. For this reason, it is
strongly recommended that the client specify a different port number using the PORT command
prior to the data transfer. For example, suppose the client specifies port 1742 using PORT. The
server-DTP would then create a connection from its port 20 to the clients port 1742 instead of
1678. This process is shown in Figure 72-3. P a s s i v e D a t a C o n n e c t i o n s The second
method is called a p a s s iv e data connection. The client tells the server to be passivethat is, to
accept an incoming data connection initiated by the client. The server replies, giving the client the
server IP address and port number that it should use. The server-DTP then listens on this port for
an incoming TCP connection from the user-DTP. By default, the user machine uses the same port
number it used for the control connection, as in the active case. However, here again, the client
can choose to use a different port number for the data connection if necessary (typically an
ephemeral port number). Lets consider our example again, with the control connection from port
1678 on the client to port 21 on the server, but this time consider data transfer using a passive
connection, as illustrated in Figure 72-4. The client would issue the PASV command to tell the
server it wanted to use passive data control. The server-PI would reply with a port number for the
client to usesay port 2223. The server-PI would then instruct the server-DTP to listen on this port
2223. The user-PI would instruct the user-DTP to create a connection from client port 1742 to
server port 2223. The
server would acknowledge this, and then data could be sent and received, again in either direction.
File Transfer Protocol (FTP) 1179
FTP Replies Each time the user-PI sends a command to the server-PI over the control connection,
the server sends back a reply. FTP replies serve three main purposes: They serve as
confirmation that the server received a command. They tell the user device whether or not the
command was accepted, and if an error occurred, what it was. They communicate various types

Potrebbero piacerti anche