File Transfer Protocol (FTP)
Last Updated :
04 Apr, 2025
File transfer protocol (FTP) is an Internet tool provided by TCP/IP. The first feature of FTP was developed by Abhay Bhushan in 1971. It helps to transfer files from one computer to another by providing access to directories or folders on remote computers and allows software, data, and text files to be transferred between different kinds of computers. The end-user in the connection is known as localhost and the server which provides data is known as the remote host.
The goals of FTP are:
- It encourages the direct use of remote computers.
- It shields users from system variations (operating system, directory structures, file structures, etc.)
- It promotes the sharing of files and other types of data.
Why FTP?
FTP is a standard communication protocol. There are various other protocols like HTTP which are used to transfer files between computers, but they lack clarity and focus as compared to FTP. Moreover, the systems involved in connection are heterogeneous systems, i.e. they differ in operating systems, directories, structures, character sets, etc the FTP shields the user from these differences and transfers data efficiently and reliably.
FTP can transfer ASCII, EBCDIC, or image files. The ASCII is the default file share format, in this, each character is encoded by NVT ASCII. In ASCII or EBCDIC the destination must be ready to accept files in this mode. The image file format is the default format for transforming binary files.
FTP Clients
FTP works on a client-server model. The FTP client is a program that runs on the user's computer to enable the user to talk to and get files from remote computers. It is a set of commands that establishes the connection between two hosts, helps to transfer the files, and then closes the connection.
Some of the commands are: get the filename(retrieve the file from thedirectories get server), mget filename(retrieve multiple files from the server ), ls(lists files available in the current directory of the server). There are also built-in FTP programs, which makes it easier to transfer files and it does not require remembering the commands.
Type of FTP Connections
FTP connections are of two types:
1. Active FTP connection: In an Active FTP connection, the client establishes the command channel and the server establishes the data channel. When the client requests the data over the connection the server initiates the transfer of the data to the client. It is not the default connection because it may cause problems if there is a firewall in between the client and the server.
2. Passive FTP connection: In a Passive FTP connection, the client establishes both the data channel as well as the command channel. When the client requests the data over the connection, the server sends a random port number to the client, as soon as the client receives this port number it establishes the data channel. It is the default connection, as it works better even if the client is protected by the firewall.
Anonymous FTP
Some sites can enable anonymous FTP whose files are available for public access. So, the user can access those files without any username or password. Instead, the username is set to anonymous and the password to the guest by default. Here, the access of the user is very limited. For example, the user can copy the files but not allowed to navigate through directories.
How FTP works?
The FTP connection is established between two systems and they communicate with each other using a network. So, for the connection, the user can get permission by providing the credentials to the FTP server or can use anonymous FTP.
When an FTP connection is established, there are two types of communication channels are also established and they are known as command channel and data channel. The command channel is used to transfer the commands and responses from client to server and server to client. FTP uses the same approach as TELNET or SMTP to communicate across the control connection. It uses the NVT ASCII character set for communication. It uses port number 21. Whereas the data channel is used to actually transfer the data between client and server. It uses port number 20.
The FTP client using the URL gives the FTP command along with the FTP server address. As soon as the server and the client get connected to the network, the user logins using User ID and password. If the user is not registered with the server, then also he/she can access the files by using the anonymous login where the password is the client's email address. The server verifies the user login and allows the client to access the files. The client transfers the desired files and exits the connection. The figure below shows the working of FTP.
Detail Steps of FTP
- FTP client contacts FTP server at port 21 specifying TCP as transport protocol.
- Client obtain authorization over control connection.
- Client browse remote directory by sending commands over control connection.
- When server receives a command for a file transfer, the server open a TCP data connection to client.
- after transferring one file, server closes connection.
- server opens a second TCP data connection to transfer another file.
- FTP server maintains state i.e. current directory, earlier authentication.

Transmission Mode
FTP transfer files using any of the following modes:
- Stream Mode: It is the default mode. In stream mode, the data is transferred from FTP to TCP in stream bytes. Here TCP is the cause for fragmenting data into small segments. The connection is automatically closed if the transforming data is in the stream bytes. Otherwise, the sender will close the connection.
- Block Mode: In block mode, the data is transferred from FTP to TCP in the form of blocks, and each block followed by a 3-byte header. The first byte of the block contains the information about the block so it is known as the description block and the other two bytes contain the size of the block.
- Compressed Mode: This mode is used to transfer big files. As we know that, due to the size limit we can not transfer big files on the internet, so the compressed mode is used to decrease the size of the file into small and send it on the internet.
FTP Commands
Sr. no. | Command | Meaning |
---|
1. | cd | Changes the working directory on the remote host |
2. | close | Closes the FTP connection |
3. | quit | Quits FTP |
4. | pwd | displays the current working Directory on the remote host |
5. | dir or ls | Provides a Directory Listing of the current working directory |
6. | help | Displays a list of all client FTP commands |
7. | remotehelp | Displays a list of all server FTP commands |
8. | type | Allows the user to specify the file type |
9. | struct | specifies the files structure |
Applications of FTP
The following are the applications of FTP:
- FTP connection is used by different big business organizations for transferring files in between them, like sharing files to other employees working at different locations or different branches of the organization.
- FTP connection is used by IT companies to provide backup files at disaster recovery sites.
- Financial services use FTP connections to securely transfer financial documents to the respective company, organization, or government.
- Employees use FTP connections to share any data with their co-workers.
Advantages of FTP
- Multiple transfers: FTP helps to transfer multiple large files in between the systems.
- Efficiency: FTP helps to organize files in an efficient manner and transfer them efficiently over the network.
- Security: FTP provides access to any user only through user ID and password. Moreover, the server can create multiple levels of access.
- Continuous transfer: If the transfer of the file is interrupted by any means, then the user can resume the file transfer whenever the connection is established.
- Simple: FTP is very simple to implement and use, thus it is a widely used connection.
- Speed: It is the fastest way to transfer files from one computer to another.
Disadvantages of FTP
- Less security: FTP does not provide an encryption facility when transferring files. Moreover, the username and passwords are in plain text and not a combination of symbols, digits, and alphabets, which makes it easier to be attacked by hackers.
- Old technology: FTP is one of the oldest protocols and thus it uses multiple TCP/IP connections to transfer files. These connections are hindered by firewalls.
- Virus: The FTP connection is difficult to be scanned for viruses, which again increases the risk of vulnerability.
- Limited: The FTP provides very limited user permission and mobile device access.
- Memory and programming: FTP requires more memory and programming efforts, as it is very difficult to find errors without the commands.
Similar Reads
CCNA Tutorial for Beginners This CCNA Tutorial is well-suited for the beginner as well as professionals, and It will cover all the basic to advanced concepts of CCNA like Components of Computer Networking, Transport Layer, Network Layer, CCNA training, Cisco Networking, Network Design, Routing and Switching, etc. which are req
8 min read
Basics of Computer Networking
Components of Computer Networking
NIC Full Form - Network Interface CardNIC stands for Network Interface Card. NIC is additionally called Ethernet or physical or network card. NIC is one of the major and imperative components of associating a gadget with the network. Each gadget that must be associated with a network must have a network interface card. Even the switches
4 min read
What is a Network Switch and How Does it Work?The Switch is a network device that is used to segment the networks into different subnetworks called subnets or LAN segments. It is responsible for filtering and forwarding the packets between LAN segments based on MAC address. Switches have many ports, and when data arrives at any port, the destin
9 min read
What is Network Hub and How it Works?Hub in networking plays a vital role in data transmission and broadcasting. A hub is a hardware device used at the physical layer to connect multiple devices in the network. Hubs are widely used to connect LANs. A hub has multiple ports. Unlike a switch, a hub cannot filter the data, i.e. it cannot
6 min read
Introduction of a RouterNetwork devices are physical devices that allow hardware on a computer network to communicate and interact with one another. For example Repeater, Hub, Bridge, Switch, Routers, Gateway, Router, and NIC, etc. What is a Router?A Router is a networking device that forwards data packets between computer
12 min read
Types of Ethernet CableAn ethernet cable allows the user to connect their devices such as computers, mobile phones, routers, etc, to a Local Area Network (LAN) that will allow a user to have internet access, and able to communicate with each other through a wired connection. It also carries broadband signals between devic
5 min read
Transport Layer
Transport Layer responsibilitiesThe transport Layer is the second layer in the TCP/IP model and the fourth layer in the OSI model. It is an end-to-end layer used to deliver messages to a host. It is termed an end-to-end layer because it provides a point-to-point connection rather than hop-to-hop, between the source host and destin
5 min read
Introduction of Ports in ComputersA port is basically a physical docking point which is basically used to connect the external devices to the computer, or we can say that A port act as an interface between the computer and the external devices, e.g., we can connect hard drives, printers to the computer with the help of ports. Featur
3 min read
What is TCP (Transmission Control Protocol)?Transmission Control Protocol (TCP) is a connection-oriented protocol for communications that helps in the exchange of messages between different devices over a network. It is one of the main protocols of the TCP/IP suite. In OSI model, it operates at the transport layer(Layer 4). It lies between th
5 min read
TCP 3-Way Handshake ProcessThe TCP 3-Way Handshake is a fundamental process that establishes a reliable connection between two devices over a TCP/IP network. It involves three steps: SYN (Synchronize), SYN-ACK (Synchronize-Acknowledge), and ACK (Acknowledge). During the handshake, the client and server exchange initial sequen
6 min read
User Datagram Protocol (UDP)User Datagram Protocol (UDP) is a Transport Layer protocol. UDP is a part of the Internet Protocol suite, referred to as UDP/IP suite. Unlike TCP, it is an unreliable and connectionless protocol. So, there is no need to establish a connection before data transfer. The UDP helps to establish low-late
10 min read
Network Layer
IPv4 Addressing
Subnetting
Data Link Layer
Physical Layer
Cisco Networking Devices
Network Devices (Hub, Repeater, Bridge, Switch, Router, Gateways and Brouter)Network devices are physical devices that allow hardware on a computer network to communicate and interact with each other. Network devices like hubs, repeaters, bridges, switches, routers, gateways, and brouter help manage and direct data flow in a network. They ensure efficient communication betwe
9 min read
Collision Detection in CSMA/CDCSMA/CD (Carrier Sense Multiple Access/ Collision Detection) is a media access control method that was widely used in Early Ethernet technology/LANs when there used to be shared Bus Topology and each node ( Computers) was connected by Coaxial Cables. Nowadays Ethernet is Full Duplex and Topology is
7 min read
Collision Domain and Broadcast Domain in Computer NetworkPrerequisite - Network Devices, Transmission Modes The most common network devices used are routers and switches. But we still hear people talking about hubs, repeaters, and bridges. Do you ever wonder why these former devices are preferred over the latter ones? One reason could be: 'because they ar
5 min read
Difference between layer-2 and layer-3 switchesA switch is a device that sends a data packet to a local network. What is the advantage of a hub? A hub floods the network with the packet and only the destination system receives that packet while others just drop due to which the traffic increases a lot. To solve this problem switch came into the
5 min read