Computer Network Write up - FTP
Computer Network Write up - FTP
What is FTP?
FTP (File Transfer Protocol) is a standard network protocol used to transfer files between a
client and a server over a TCP-based network, such as the internet or an intranet. FTP allows
for both the upload and download of files, making it essential for file sharing and data transfer
between computers. FTP operates on a client-server model, where a client requests the file
and the server responds by sending or receiving the file(s).
• Active FTP (PORT mode): The server listens on a random port for incoming data.
• Passive FTP (PASV mode): The client establishes both the control and data
connections, making it more firewall-friendly.
FTP requires two ports to function because it works in two channels: the control channel and
the data channel.
1. Control Port (Port 21): This is used for sending commands between the client and the
server. It's an established, persistent connection throughout the FTP session.
2. Data Port (Port 20 or a range of ports in Passive mode): This is used for transferring
the actual files between the client and server. In active mode, the data channel is
established by the server, whereas in passive mode, the client establishes both
channels to bypass potential firewall restrictions.
• The client sends a PORT command over the control channel, and the server opens a
connection to the specified IP and port for data transfer.
• The client sends a PASV command over the control channel, and the server responds
with an IP address and port number to be used for the data transfer.
FTP commands return a series of status codes that indicate the result of the requested
operation. These codes are divided into categories based on the first digit.
• 1xx: Informational Codes – Indicates that the request was received and is being
processed.
• 2xx: Success Codes – The command was successfully received, understood, and
processed.
• 3xx: Redirection Codes – The command has been accepted, but the action requires
further input (e.g., password or another action).
• 4xx: Temporary Failure Codes – The command failed due to a temporary condition
(e.g., server overload, network timeout).
• 5xx: Permanent Failure Codes – The command failed and the action cannot be
completed (e.g., bad command syntax).
331 User name okay, need password The user name is okay, password required.
1. USER
2. PASS
o Purpose: Used to send the password for authentication after the USER
command.
o Example: LIST
o Example: PWD
9. QUIT
o Purpose: Ends the FTP session and disconnects from the server.
o Example: QUIT
10. HELP
o Example: HELP
HELP LIST
Conclusion
FTP (File Transfer Protocol) is a crucial protocol for file sharing over a network. It uses two
ports (control and data ports) to facilitate communication between the client and the server.
FTP commands are varied and designed for different file manipulation tasks like uploading,
downloading, and deleting files. Understanding FTP error codes, return codes, and commands
is vital for effective management and troubleshooting of FTP servers.