Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

FTP Server Working and its Benefits

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

FTP is a group of standard protocols that allow interconnected or networked computers to transfer files and communicate over the internet.

FTP server is basically a computer that offers access services and file storage on the internet, it handles all the data transmission between networked computers. FTP server waits for the client to connect to it and it uses the FTP protocol commands to do all the tasks such as uploading, listing directories, or downloading.

FTP is based on client/server architecture. A user is a client that supports FTP protocol through which it can connect to an FTP server on a remote host. The client can issue commands, so that the remote server can execute them, after executing the commands the host server returns the results of execution to the client. For example, the user supplies a command and asks the server to forward the file. The server will reply to the request and will send the file to the client. After that, the user can put the file in the working directory. These types of processes are carried out by the FTP servers.

Working of FTP Server:

FTP service is a TCP-based protocol, i.e., it is a file transfer protocol. By default, it uses port 20 (data port) and port 21 (command port). A user sends a service request to the server in the network. After that, the request is received by the server, which replies to the user’s request and supplies the user with the requested file transfer service. FTP uses a continuous connection communication method to keep the long control connections running. Based upon the type of mode of the connection the number of data ports can differ.

Types of Connections in FTP:

Generally, in a session where transfer of file takes place, the FTP uses two separate types of connections i.e., Data connection and Control connection.

  1. Control Connection: The control connection is used for sending commands between the user and server. It is the primary connection and it uses port 21.
  2. Data Connection: Data connection is used only for transferring data. It establishes a connection between the DTP(Data Transfer Process) of the client and server, and it uses port 20.

Types of Connection Modes:

The FTP server can support Active mode, Passive mode, or both modes.

  1. Active mode: In this mode, the user opens a port and listens while the server is actively-connected to it. Here the client can connect from any random port.
  2. Passive mode: In this mode, the server opens a port and, it passively listens to it and, the user also passively connects to it. The passive mode is used as default as a safety measure. Passive mode can be used when the user can’t receive connections i.e., in cases where the connection is blocked by a firewall.

Communication with FTP server:

A user can communicate with the FTP server by using the telnet program via port 21.

>telnet 21
Connected to
Escape character is ‘^]’.
220 ProFTPD server (EV)  []

The next step is to supply the username and password.

>USER mkcbt
331 password requires for mkcbt.
230 user mkcbt logged in
227 entering passive mode (69,198,63,156,116,239).
>telnet 29819
Connected to
Escape character is ‘^]’.
150 Opening BINARY mode data connection for file list.
226 Transfer complete
drwxrwx---         2 mkcbt       2048                    0 Nov      2     15:12.
drwxrwx---         2 mkcbt       2048                    0 Nov      2     15:12.
-rw-rw----        2 mkcbt       2048                    5 Nov      2     12:52.     xp_gif
-rw-rw----        2 mkcbt       2048                    5 Nov      2     13:12.     xc_txt
-rw-rw----        2 mkcbt       2048                    5 Nov      2     13:52.     xpc_vid
-rw-rw----        2 mkcbt       2048                    5 Nov      2     14:27.     gmarker
-rw-rw----        2 mkcbt       2048                    5 Nov      2     16:24.     test

As can be seen above, the FTP server works when a client supplies the commands and then it delivers responses.

FTP Server Benefits:

  • FTP servers offer a level of security.
  • FTP server gives the user a level of control.
  • FTP server allows a user to send big files at once.
  • It improves workflow.
  • It allows data recovery.
  • It has a resumption facility i.e., it allows the transfer of files even after a break-in connection occurs.

Drawbacks of FTP Server:

  • All the files, passwords, and usernames are sent in unencrypted text.
  • TLS 1.2 might not work over HTTPS as it is not always supported.
  • It is possible to spoof servers to send data to an unpremeditated computer or on a random port.
My Personal Notes arrow_drop_up
Last Updated : 24 Nov, 2021
Like Article
Save Article
Similar Reads
Related Tutorials