The File Transfer Protocol (FTP) is used as one of the most common means of copying files between servers over the Internet. Most web based download sites use the built in FTP capabilities of web browsers and therefore most server oriented operating systems usually include an FTP server application as part of the software suite. Linux is no exception.
Ports Used for FTP : It uses the TCP ports for transferring data from clients to server and vice versa.
- Port 21 : On this port control connection is established. All commands we send and the ftp server’s responses to those commands will go over the control connection, but any data sent back (such as “ls” directory lists or actual file data in either direction) will go over the data connection.
- Port 20 : This is the data tranfer port. All theall subsequent data transfers between the client and server are done using this port.
Type of FTP Servers :
- Active FTP : Client says to server port 21, that it want to start a FTP session. Server confirms from port 21 and initates a connection from a new dynamic port to the client. (note: client firewalls etc don’t know which port, so it is sometimes blocked as it is considered unwanted, and unrequested)
- Passive FTP : Client says to server port 21, that they want to start a FTP session. Server confirms and tells the client to connect to specified dynamic port (8674 for instance) for FTP data transfer. Client connects to server port 8674, and server replies. (note: the server reply isn’t blocked because the firewall has logged that the client has at some point communicated with server on port 8674)