TCP/IP Application File Transfer Protocol (FTP)

J

Jarret W. Buse

Guest
TCP/IP Application File Transfer Protocol (FTP)

The versatility of TCP/IP to be run on a variety of systems allows a wide range of possibilities. File Transfer Protocol (FTP) shows how this is possible by allowing file sharing across platforms and systems.

The File Transfer Protocol (FTP) is a TCP/IP Application and Protocol. FTP was created to allow the transfer of files between hosts which were not running the same Operating System (OS) or physical hardware. For example, files can be shared between different OSs such as a Linux system and a Microsoft Windows system. An example of different physical hardware systems could be a PC and an Apple Mac system.

Let’s look at the protocol first to better understand the background of FTP.

Protocol

FTP is used to allow a file to be copied from one host to another over a TCP/IP network. FTP guarantees delivery by using the Transport Control Protocol (TCP).

NOTE: Be aware of the existence of Trivial File Transfer Protocol (TFTP) which is connectionless. It is not guaranteed delivery, since it uses the User Datagram Protocol (UDP). The reason for TFTP was to allow for a smaller overhead on diskless workstations that could only store information in Random Access Memory (RAM). The purpose was for the diskless workstations to copy programs to RAM for booting processes since there wasn’t a local disk for storage.

The protocol allows for the transfer of files and accomplishes this by setting up the connection between the hosts using TCP (or UDP for TFTP). There are two connections required between the hosts.

  1. Data Connection – used to transfer the data between the two hosts (port 21).
  2. Control Connection – used to transfer control commands between the hosts (port 20).
There are three processes running on the client system and two on the server system as shown in Figure 1.

NOTE: The server system is not specifically a Server, but is termed a server since it is sharing a resource. The client system is the system on which FTP is initiated.


TCPIP Application FTP Figure 1.JPG

FIGURE 1​

The files are transferred between the Data Connection on the Client and Server side through Port 21. FTP commands are sent through the Client and Server Protocol Interpreter on Port 20. Keep in mind that each connection can transmit or receive information. The Data Connection can send or receive files while the Protocol Interpreter can send or receive FTP commands. The Protocol Interpreter controls the Data Connection by starting and stopping transfers.

The User Interface on the client side can be command-line or a Graphical User Interface (GUI) to send and view commands to the Protocol Interpreter.

The Data Connection is also shown as having access to the file system on the respective host. This allows the reading and writing of the files being transferred.

In some cases, the FTP server side will not allow access to all files by all users. Some or all files may require permissions. In this case, there is a seven step process to authenticate a user:
  1. Session to Server is initiated by Client.
  2. TCP connection is made to Server which responds with “Ready”.
  3. Client receives “Ready” and sends User Name.
  4. Server receives User Name and sends “Need Password”.
  5. Client receives “Need Password” and sends User Password.
  6. Server receives User Password and verifies User Name and Password. If Verified, Server sends “Verified”. If not verified, Server sends “Denied”.
  7. Client opens connection of Server “Verifies” connection. Otherwise, connection is closed.

NOTE: Keep in mind that the Control Connection is open throughout the FTP connection. The Data Connection is only open while the file is transferred. Once the transfer is complete, the Data Connection is closed. The Data Connection is re-opened when another transfer is started.

Information sent over the Data Connection is sent in one of three modes:

  1. Stream Mode – Data is sent unstructured, which means there are not typical headers as associated with TCP/IP. With no headers, there is no overhead. The bits are streamed over the connection. This method is usually the default.
  2. Block Mode – The file is split into blocks and encapsulated into TCP/IP frames. The frames are transmitted in the same manner as with any TCP/IP connection.
  3. Compressed Mode – Repeating strings of data are compressed and sent as encapsulated frames as any TCP/IP connection. Files already compressed as ZIP files or other compressed types gain nothing since the files already have repeating strings compressed.
The Control Connection can handle different Command Groups. There are three Command Groups used to send commands over the Control Connection session on Port 20:
  1. Access Control – Authentication commands for the User to gain access to the files.
  2. Transfer Parameters – Designates specifics on how the file is to be transferred, such as the mode.
  3. FTP Commands – Actual commands to control the transfer, renaming or deleting files.
Service

To Install FTP on Linux, go to a Terminal and enter: sudo apt-get install vsftpd.
After the installation is completed, open the following file: /etc/vsftpd.conf for editing.
Here you want to look at the following lines:

anonymous_enable=YES
write_enable=YES

The first line allows for anonymous access to the files. The second line allows a client to change local files (this includes uploading files as well).

Another item to possibly change is the line: “ftpd_banner=Welcome to my Linux FTP Server!”. This changes the banner that the client will see when they connect to your FTP Server. Save the changes and restart the FTP Service by entering: “sudo /etc/init.d/vsftpd restart”. Files accessible by FTP Clients should be placed into the /srv/ftp/ folder.

Application

There are a variety of FTP Client Applications available. Some examples include:

  • FireFox
  • Kasablanca
  • KFTPGrabber
  • Gnome Commander
  • FileRunner
  • Konqueror
  • and others
 

Attachments

  • slide.jpg
    slide.jpg
    45.5 KB · Views: 103,914


Jarret,
I want to make a simple FTP server, that would allow my friends to download files from my computer online.
I am using Cent OS, and I want this as secure as it can be .
can you please tell ?
 
Amol your best bet is to use an sftp server that is chrooted. That really offers the best security.
 
vsftp would still pass data in the clear. vsftp is and FTP server and not an SFTP server. I do think you can setup FTPs (FTP over SSL) with it, but why go to that trouble.
 
vsftp would still pass data in the clear. vsftp is and FTP server and not an SFTP server. I do think you can setup FTPs (FTP over SSL) with it, but why go to that trouble.

The "vs" in vsftp stands for "Very Secure". Many websites/servers use vsftp due to its security. (https://security.appspot.com/vsftpd.html)


@Amol Patil

Check out this site which explains how to set up vsftp to use SSL and other security measures. (http://wiki.vpslink.com/Configuring_vsftpd_for_secure_connections_(TLS/SSL/SFTP))
 
I agree that vsftp is a good FTP server, but remember unless you are doing SSL you are not encrypting anything. You can be as secure as you want to with vsftpd, but without encryption you are still passing information in the clear.
 

Members online


Latest posts

Top