Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

Application of FTP Protocol in Internet of Things – IOT Part 43

By Priya

File Transfer Protocol (FTP) is a standard protocol for transferring files between a client and server over an internet network. The FTP protocol was written by Abhay Bhushan (IIT Kanpur) in 1971. In 1980, a TCP/IP version of the protocol as RFC 765 was introduced which became the de facto standard worldwide. in 1998, the protocol stack was updated for IPv6 support. Within this protocol, the security features were enabled by a  TLS/SSL layers called FTP Secure (FTPS). A new secured version of FTP is also widely used called SSH File transfer protocol (SFTP). The SFTP is quite different protocol than the traditional FTPS. 
Representational Image of FTP Protocol
 Fig. 1: Representational Image of FTP Protocol
The FTP protocol is based on Client-Server model, so device at one end request files while the device at other end responds to the request. There are separate control and data connections between the client and the server. The FTP clients need to authenticate themselves to the server by a sign in the protocol. The sign in is usually in the form of username and password. An FTP client can also sign in as anonymous user if it is allowed by the server. Earlier FTP client applications used to be command line programs, though now client utilities with graphic UI are commonly available.  
FTP Connection 
An FTP client can communicate with an FTP server in either of two modes – Active or Passive mode.  In active connection, the client listens to a port (PORT M) and while making connection to server it sends (PORT M) FTP commands to inform the server which port it is listening. Then the server initiates a data channel to client on that port (PORT M) using port number 20 where port 20 is the FTP server data port and the data transfer starts. 
In passive connection, the FTP client send a PASV command to the FTP server using a control connection. The server responds to the command by sending its IP address and port number. The client then can open a data connection using an arbitrary port number to the received IP address and server port number. The passive mode was introduced to allow communication with clients that fall behind a Firewall and so, cannot accept a TCP connection.   
In passive mode, the FTP server responds to the client in the form of three-digit codes over the control connection. The response includes a number and an optional text. The number (three-digit number) represents the response code while the optional text is a human readable explanation of the response code. The first digit in  the response code denotes the kind of response and can range from 1 to 6. The first digit in the response code has the following significations – 
Table Listing Significations of First Digit in Response Code of FTP Server
         Fig. 2: Table Listing Significations of First Digit in Response Code of FTP Server
Table Listing Significations of First Digit in Response Code of FTP Server
    Fig. 3: Table Listing Significations of First Digit in Response Code of FTP Server
The second digit in the response code specifies the type of data transfer as follow – 
Table Listing Significations of Second Digit in Response Code of FTP Server
           Fig. 4: Table Listing Significations of Second Digit in Response Code of FTP Server
Table Listing Significations of Second Digit in Response Code of FTP Server
                   Fig. 5: Table Listing Significations of Second Digit in Response Code of FTP Server
Some of the common response codes are as follow – 
Table Listing Common Response Codes of FTP ServerTable Listing Common Response Codes of FTP Server
 
Fig. 6: Table listing common response codes of FTP Server      Fig. 7: Table listing common response codes of FTP Server
 Once the client and server are connected, they can transfer the following four data representations – 
 
1) ASCII mode – It is used for text transferring, data is converted into “8-bit ASCII” before or after transferring if necessary, but it is not suitable for the data other than plain text.  
2) IMAGE mode – It is called binary mode, used in transferring images, the data is sent in binary form byte by byte, the receiver receives that byte-stream and stores it as sync with receiving. 
3) EBCDIC Mode – It is used for plain text between hosts using the EBCDIC character set
4) Local Mode – It allows two machines that has identical setup, transfer data without converting into ASCII (in a proprietary format).
The data transfer can happen in either of the following three modes – 
1) Stream Mode – In this mode data is sent as continuous stream without any processing at the FTP. Instead, the processing of data is done at the TCP layer. 
2) Block Mode – In this mode, FTP breaks data into blocks and pass those blocks to the TCP layer. 
3) Compressed Mode –  In this mode, the data is first compressed using a compression algorithm before passing to the TCP layer. 
FTP Login –
FTP client first has to login to FTP server in order to transfer data. The client can authenticate using username, password if server allows. The commands to authentication can be sent on port 21 for login. The username can be sent using USER command and the password can be sent using PASS command. This sequence is in plain text form and is venerable to sniffing attacks (Network traffic capture).
Anonymous FTP access –
A FTP server is sometimes allowed to login without username and password. Client can login to server using an anonymous account, when asked for username user can type “anonymous” and then server asks for an email address instead of password (No verification of data is performed). This can be seen in an update server which just provides only updates.
FTP Features – 
1) Web Browser Support – FTP supports web bowser logins and data surfing. The most common and new web browser can retrieve files hosted on FTP server. Using FTP in web browser, most of the advance web applications are using ftp to provide downloads and updates. A user can login to FTP server using web browser and surf data there. The syntax to login from browser looks like the following – [ftp://[user[:password]@]host[:port]/url-path]
2) Security – The security in FTP is not provided in the traditional version. The logins credentials and commands transferred to server are in plane text without any encryption. Thus, any network sniffer can read the data. Common attacks FTP is venerable to are as follow – 
• Brute force attack
• FTP bounce attack
• Packet capture
• Port stealing (guessing the next open port and usurping a legitimate connection)
• Spoofing attack
• Username enumeration
The Solutions to these security weaknesses are as follow – 
1. Use secure version of FTP – FTPS instead of traditional FTP, like instead of TELNET use TELNETS.
2. Use a more secure protocol for data transfer that can handle encryption like SSH file transfer protocol.
3. Use a secure connection to server like use VPN instead of directly connecting to the server.
There are some variants of FTP that provides secured data communication like FTPS, SFTP, TFTP, SSH File Transfer Protocol, which can also be used. 
In the next tutorial, FTP protocol will be implemented in an IoT application. In the next tutorial, a Raspberry Pi will be configured as a FTP client and will be made to download files from a FTP server. 

Filed Under: Tutorials

 

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Designing Gate Driver Circuit and Switching Mechanism for Modified Sine Wave Inverter – (Part 9/17)
  • Completing Modified Sine Wave Inverter Design with Full Bridge Circuit and Step Up Transformer – (Part 10/17)
  • Designing an Offline UPS – Part (12 /17)
  • How to reduce Switching Time of a Relay – (Part 15/17)
  • Testing MOSFET – (Part 16/17)
  • Driving High Side MOSFET using Bootstrap Circuitry – (Part 17/17)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Renesas to demonstrate first working silicon based on the Arm Cortex-M85 processor
  • STMicroelectronics releases first automotive IMU with embedded machine learning
  • Infineon offers DC-DC controller for full LED headlamps without a microcontroller
  • Vishay launches new high-precision, thin-film wraparound chip resistor
  • STMicroelectronics’ common-mode filters ensure signal integrity in serial interfaces

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd ldr led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Capacitive Switches
  • CSI-2 FIFO or Line buffer?
  • Temperature sensor readout
  • What is the function of the long stub?
  • Circuit Performance Exploration

RSS Electro-Tech-Online.com Discussions

  • Opamp ciruit
  • Audio equalizer
  • Background of Members Here
  • software PWM
  • SPI Questions
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering