What is FTP and how does an FTP work?
Have you ever downloaded a new version of Firefox or any other application? If so, then you probably have used the FTP(File Transfer Protocol) without even knowing it. Through today's browser, we can download the files via FTP from within the browser window. It is very easy and convenient for downloading files. But there is not much flexibility available while downloading some files from the browser also, we cannot upload files. So, we can use FTP clients for transferring files. So, in this blog, we will learn how does an FTP work.
File Transfer Protocol is a set of protocols that the networked computers use to talk over the internet. In more simple terms, it is a way to connect two computers and move files between them. FTP allows new web pages that are created by an individual to show up on the internet. It allows the web pages to transfer to the server so that others can access them.
Using an FTP client we can upload, download, delete, move, rename and copy the file on a server. If you send your file through FTP then your files mainly perform upload or download from the FTP server. When you are uploading the files then you are transferring the files to the server from your personal computer and when you are downloading the file you are transferring the file from the server to your personal computer.
How does File Transfer Protocol work?
FTP is a client-server protocol and it relies on two communication channels between the client and the server.
- Control Connection: The FTP client, for example, FileZilla or FileZilla Pro sends a connection request usually to server port number 21. This is the control connection. It is used for sending and receiving commands and responses. Typically a user needs to log on to the FTP server for establishing the connection but there are some servers that make all their content available without login. These servers are known as anonymous FTP.
- Data Connection: For transferring the files and folder we use a separate connection called data connection.
This connection can be established in two ways:
- Active Mode: In this mode, the user connects from a random port(random port 1) on the FTP client to the port 21 of the server. It sends the PORT command which tells the server that what port of the client it should connect to i.e.(random port 2). The server connects from the port 20 to the port which the client has designated i.e. Random Port 2. Once the connection is established the data transfer takes place through these client and server port.
- Passive Mode: In the situation, where the client can not accept connection like when blocked by a firewall, the passive mode has to be used. This is the most common mode because nowadays the client is behind the firewall(e.g. built-in Windows Firewall). In this mode, the user connects from a random port(random port 1) on the FTP client to the port 21 of the server. It sends the PASV command which tells the client that what port of the server it should connect to i.e.(random port 3) for establishing the connection. The client connects from the Random port 2 to the port which the server has designated i.e. Random Port 3. Once the connection is established the data transfers take place through these client and server port.
Advantages of using FTP
- It allows you to transfer multiple files and folders.
- When the connection is lost then it has the ability to resume the transfer.
- There is no limitation on the size of the file to be transferred. The browsers allow a transfer of only up to 2 GB.
- Many FTP clients like FileZilla have the ability to schedule the transfers.
- The data transfer is faster than HTTP.
- The items that are to be uploaded or downloaded are added to the ‘queue’. The FTP client can add items to the ‘queue’.
Disadvantages of using FTP
- FTP doesn't encrypt the traffic so usernames, passwords, and other data can easily be read by capturing the data packets because while transferring as they are sent in cleartext. FTP is vulnerable to packet capture and other attacks.
This is all about FTP. Hope you enjoyed reading this blog.
Keep Learning :)