FTP and TFTP

Broken Code
3 min readMay 17, 2022

--

FTP stands for File Transfer Protocol. It is an industry standard protocol used to transfer files from one machine to another. FTP uses client-server model. Clients can use ftp to copy files from a server as well as to copy files to a server.

FTP is an application layer protocol which uses TCP port number 20 and 21 for transmitting the files from one host to another. Port 21 is used to establish the connection between the two hosts and port 20 is used to transfer the data. The control channel (Port 21) is used for transmitting commands as well as replies to those commands while the data channel (Port 20) is used for transferring actual data. This separation of command information and data into separate channels is a way of being able to send commands to the server without having to wait for the current data transfer to finish. If both channels were interlinked, we would had to enter commands in between data transfers which wouldn’t had be efficient for either large file transfers or slow internet connections.

FTP sends and receives data as cleartext. This makes it less secure. FTP could be secured using SSL/TLS by using the FTPS protocol. FTP can also be secured using the SSH protocol (SFTP protocol). Note that FTPS is an upgrade to FTP whereas SFTP is a different protocol.

FTP works in two different modes:

Active mode and Passive mode.

Active mode: In ftp active mode, the server initiates the data connection.

Passive mode: In ftp passive mode, the client initiates the data connection.

TFTP

TFTP stands for Trivial File Transfer Protocol. It is a simple protocol which allows a client to copy a file to or from a server. It has only basic features compared to FTP. TFTP was released after FTP and is not a replacement for FTP. It is just another tool to use when simplicity is more important than functionality. In TFTP when the client sends the first message to the server, the destination port is UDP 69 and the source is a random port. After that port 69 is not used.

TFTP fle transfers have three phases

1: Connection: TFTP client sends a request to the server and the server responds back, initializing the connection.

2: Data Transfer: One sends data and the other sends acknowledgments.

3: Connection Termination: After the last data message has been sent, a final acknowledgment is sent to terminate the connection.

FTP vs TFTP

  • FTP stands for File Transfer Protocol. TFTP stands for Trivial File Transfer Protocol.
  • FTP services are provided by TCP. TFTP services are provided by UDP.
  • FTP works on two ports: port number 20 (data connection) and port number 21 (conrol connection). TFTP works on port number 69.
  • FTP needs authentication for communication. TFTP does not need authentication for communication.
  • FTP allows not only file transfers, but clients can also navigate directories, add and remove files, directories etc. TFTP only allows a client to copy a file to or from a server.
  • FTP is more complex than TFTP. TFTP is simple.

--

--

Broken Code
Broken Code

No responses yet