Difference between active and passive FTP in Linux
It is an application layer protocol that handles network file transfers. The service is TCP-based. Understanding active and passive modes or understanding the difference between active and passive modes can be challenging.
An administrator can set an FTP server in one of two default configurations: Active or Passive. Initially, the only available FTP method was active mode. It is frequently FTP's default mode. Each time a client and server want to send data, they open a Control Connection first to discuss the specifics of the Data Connection before establishing it and transferring data. When using an active mode connection, as soon as the client establishes the connection and sends PORT, it has to initiate the second connection back is the server. This serves as an enquiry for a port to make a connection. The moment the client receives a port, the second connection is established, and data is sent. This works in conjunction with a firewall that has port forwarding enabled for increased security. To prevent external clients from directly contacting the server, data will be routed from the firewall's port to the server's port. It is necessary to pair the IP address from the first Control Connection with an unutilized port, typically a port with a number between 1024 and 65535.
Active Mode
The client sends the server a PORT instruction, telling it to "actively" give an IP address and port number to open the client-side Data Connection.
Passive Mode
The client delivers a PASV command to signal that it will wait "passively" for the server to supply an IP and port number, following which the client will initiate a data connection to the server. If the client fails to submit a PASV command, Port 20 is the Data Connection's default value.
The firewall's administrator should constantly demand PASV connections. Once the IP address and port have been decided upon, the party who selected the IP address and port will start listening to those addresses and ports and wait for the other side to connect. Connecting to the listening party from the other party, data transport starts. Once the data transmission is complete, the data sender will terminate the data connection.
Difference between Active and Passive FTP
Active FTP | Passive FTP |
In active FTP, the server and client create the data channel and the command channel, respectively. | In passive FTP, the client creates both the data channel as well as the control channel. |
The FTP server is protected by Active FTP. | The FTP server's security is not provided by passive FTP. |
Due to firewalls, active FTP may cause issues. | Firewall-related connectivity problems are not an issue with passive FTP. |
A browser's active mode is not set as the default. | A browser's default setting is called passive mode. |
The FTP client acknowledges the data channel. | The FTP server confirms the data channel. |