0% found this document useful (0 votes)
4 views

Computer Network Write up - FTP

FTP (File Transfer Protocol) is a standard network protocol for transferring files between a client and server over TCP networks, utilizing both active and passive modes. It operates using two ports: a control port for commands and a data port for file transfers, with various return codes indicating the status of operations. Understanding FTP commands and error codes is essential for effective file management and troubleshooting.

Uploaded by

dkmishra2407
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Computer Network Write up - FTP

FTP (File Transfer Protocol) is a standard network protocol for transferring files between a client and server over TCP networks, utilizing both active and passive modes. It operates using two ports: a control port for commands and a data port for file transfers, with various return codes indicating the status of operations. Understanding FTP commands and error codes is essential for effective file management and troubleshooting.

Uploaded by

dkmishra2407
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Write up – FTP Sever

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).

FTP is defined in two versions:

• 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.

Why FTP Requires Two Ports

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.

Active Mode FTP (PORT mode):

• 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.

Passive Mode FTP (PASV mode):

• 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 Error and Return Codes

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.

General FTP Return Codes:

• 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).

Common FTP Error and Return Codes:

Code Meaning Description

The command was successful and


200 Command okay
completed.

The FTP server is ready to accept


220 Service ready
connections.

The FTP server is closing the control


221 Service closing control connection
connection.

230 User logged in Login successful.

250 Requested file action okay File action was successful.

331 User name okay, need password The user name is okay, password required.

332 Need account for login Account required for login.

Service not available, closing control


421 Server not available, closing connection.
connection

425 Can't open data connection Data connection couldn't be established.

Transfer aborted due to a connection


426 Connection closed; transfer aborted
closure.

530 Not logged in The user is not logged in or authenticated.

File or directory does not exist or permission


550 Requested action not taken
denied.

10 Common FTP Commands with Examples

1. USER

o Purpose: Used to send the username for authentication.

o Example: USER ftpuser

2. PASS

o Purpose: Used to send the password for authentication after the USER
command.

o Example: PASS mypassword


3. LIST

o Purpose: Lists the files and directories in the current directory.

o Example: LIST

4. CWD (Change Working Directory)

o Purpose: Changes the current directory on the server.

o Example: CWD /home/ftpuser/files

5. PWD (Print Working Directory)

o Purpose: Displays the current directory on the server.

o Example: PWD

6. RETR (Retrieve File)

o Purpose: Downloads a file from the server.

o Example: RETR example.txt

7. STOR (Store File)

o Purpose: Uploads a file to the server.

o Example: STOR uploadfile.txt

8. DELE (Delete File)

o Purpose: Deletes a file on the server.

o Example: DELE example.txt

9. QUIT

o Purpose: Ends the FTP session and disconnects from the server.

o Example: QUIT

10. HELP

o Purpose: Lists all available commands or provides help on a specific command.

o Example: HELP

or to get help on a specific command:

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.

You might also like