FTP ( File Trasnfer Protocal ) is TCP based service. FTP is widely use for transferring files over network. There are various ftp servers available to use like vsftpd, proftpd, pureftpd etc.
FTP uses two different ports –
1. Port 20 is used for data port, But the data port is not always on 20 port. It may change in passive mode.
2. Port 21 is used as command port.
FTP works on two different modes (Active FTP vs Passive FTP) as per server and client configuration. In this article, I am trying to define Active FTP vs Passive FTP a definitive explanation, I hope this will help you to understand its working.
Active Mode FTP:
In Active mode ftp the client connects from any random unprivileged port ( For example ‘X’ ( greater than 1023 ) ) to FTP Server port 21. Client agagin send ‘X+1’ port to ftp server which is acknowledges on command channel. After that FTP server opens data channel on port 20 to Clients port X+1.
- FTP client opens up command channel from client on port 1050 ( 1050 is for example only ) to server port 21.
- FTP client sends PORT 1051 ( 1050 + 1 ) to FTP server and server acknowledges on command channel.
- FTP Server opens up data channel from server port 20 to client port 1051.
- FTP client acknowledges on data channel.
Passive Mode FTP:
In Passive mode ftp the client connects from any random unprivileged port ( For example ‘X’ ( greater than 1023 ) ) to FTP Server port 21. After that client send a PASV signal to ftp server command channel to inform server for using passive mode. FTP server sends back on unpriviledge port (For example ‘Y’ ( greater than 1023 )). Now FTP client opens data channel on ‘X+1’ to FTP server PORT ‘Y’. Which acknowledges by FTP server.
- FTP client opens up command channel from client on port 1050 (1050 is for example only) to server port 21.
- FTP client sends PASV command to server on command channel.
- FTP server sends back (on command channel) PORT 1250 (1250 for example only) after starting to listen on that port.
- FTP client opens up data channel from client 1051 to server port 1250.
- FTP server acknowledges on data channel.
I hope above details may help you understand difference between Active FTP vs Passive FTP, We are waiting for your comments for this article is helpful or not helpful for you.