SlideShare a Scribd company logo
1 of 24
FTP - File Transfer Protocol
TFTP – Trivial FTP
CISC 856 – Fall 2007
Brian Lucas
University of Delaware
(some/most slides courtesy of
Umakanth Puppala, William Boyer
Vikram Rajan, Michael Haggerty, and Prof Amer)
lucasb@capsl.udel.edu
Overview
File Transfer Protocol (RFC 959)
• Why FTP?
• FTP’s connections
• FTP in action
• FTP commands/responses
Trivial File Transfer Protocol (RFC 1350)
• TFTP and TFTP’s message formats
• FTP and TFTP compared
Why do we need a FTP
Service?
Purpose: To Transfer files between two computers
Goals of FTP Service
• Promote sharing of files (programs and/or data)
• Encourage indirect/implicit use of remote computers
• Shield users from variations in file storage among hosts
• Transfer data reliably and efficiently
Problems of File Transfer
• At first, file transfer may seem simple
• Heterogeneous systems use different:
– Operating Systems
– Character Sets
– Naming Conventions
– Directory Structures
– File Structures and Formats
• FTP needs to address and resolve these
problems
FTP’s Connections
User
Interface
User
Data Transfer
Function
User
Protocol
Interpreter
Server
Protocol
Interpreter
Server
Data Transfer
Function
client
server
Control
Connection
Data
Connection
* Insulates users from “raw”
FTP commands
Server is listening on port 21
for connection requests
2
* Routes “raw” FTP commands
* Receives server’s replies
* Persistent command
and reply connection
Non-persistent data
connection
21
20
*Server uses port 20
for data connections
FTP’s Connections – Establishment
User
Interface
User
Data Transfer
Function
User
Protocol
Interpreter
Server
Protocol
Interpreter
Server
Data Transfer
Function
client
server
Control
Connection
Data
Connection
2
ftp> open strauss.udel.edu
Connected to strauss.udel.edu
220 strauss FTP server ready.
USER lucasb
331 Password req for lucasb.
Password:
PASS mypass
230 User lucasb logged in.
ftp>
128.4.40.17 (19×256)+137
128.4.40.17:5001
User
Data Transfer
Function
Server
Data Transfer
Function
User
Interface
User
Protocol
Interpreter
Server
Protocol
Interpreter
client
server
Control
Connection
Data
Connection
2
ls client.txt
Passive open on
Port 5001
PORT 128,4,40,17,19,137
200 Port Command Sucessful
LIST client.txt
150 Data Connection will be open shortly
226 Closing Data Connection
-rw-r--r-- lucasb client.txt
Establish Data Connection
User
Protocol
Interpreter
Server
Protocol
Interpreter
FTP’s Connections
Data Transfer
128.4.40.17 19,137
User
Interface
User
Protocol
Interpreter
Server
Protocol
Interpreter
client
server
Control
Connection
Data
Connection
2
User
Data Transfer
Function
Server
Data Transfer
Function
bye
QUIT
221 Service Closing
FTP’s Connections – Connection
Closing
FTP Connection
ftp> open server SYN
SYN|ACK
ACK
220 Service Ready
ftp> USER lucasb
ACK
ACK
331 User OK,password?
ACK
ftp> PASS mypass
ACK
230 User login OK
ACK
Client Server
21
Eph
FTP Data Transfer
PORT 128,4,40,17,19,137
200 Command Successful
LIST client.txt
ACK 150 Data Connection
will be open shortly
226 Closing Data
Connection
ACK
ACK
Control connection
Data Connection
Client Server
Eph
Eph
21
21
5001
20
5001 20
FTP Client Commands (issued by user interface)
Command Description
get filename Retrieve file from server
mget filename* Retrieve multiple files from server*
put filename Copy local file to server
mput filename* Copy multiple local files to server*
open server Begin login to server
bye / close / exit Logoff server
ls / dir List files in current remote dir on server
lcd Change local directory
cd Change remote directory
rhelp / remotehelp Lists commands the server accepts
* Sent to server as multiple command by User Protocol Interpreter
A-PDU FTP Commands
Command Description
LIST [filelist ] List files or directories (ls / dir)
USER username Send username to server
PASS password Password on server
PORT h1,h2,h3,h4,p1,p2 Client IP and port number
RETR filename Retrieve (get) filename
STOR filename Store (put) filename
TYPE (A, I, E, N or T) Defines the file type or print format
FTP Response format
Reply Description
1yz
2yz
3yz
4yz
5yz
Positive preliminary reply.The action is being started but
expect another reply before sending another cmd.
Positive completion reply. A new cmd can be sent.
Positive intermediate reply. The cmd has been accepted but
another cmd must be sent.
Transient negative completion reply. The requested action
did not take place but can be sent later
Permanent negative completion reply. Cmd not accepted and
should not be reissued.
x0z
x1z
x2z
x3z
x4z
x5z
Syntax errors
Information
Connections. Replies referring to control or data connections.
Authentication and accounting
Unspecified
Filesystem status
Example FTP Responses
• 120 Service will be ready shortly
• 200 Command OK
• 230 User login OK
• 331 User name OK; password is needed
• 421 Service not available
• 530 User not logged in
• 552 Requested action aborted; exceeded storage allocation
Summary of FTP connections
• FTP has 2 connections
- Control (persistent connection)
- Server issues a passive open on well-known 21
- Client uses an ephemeral port to issue active open
- Server ultimately closes control connection
- Data (ephemeral connection)
- Client issues passive open on an ephemeral port
- Client sends this port to server via PORT
command
- Server receives the port number and issues active
open using its well-known 20 to the received
ephemeral port
Data Connection
• Connection does not always work…why?
• Instead, use PASV command
– Client sends PASV command to server
– Server chooses ephemeral port: passive open
– Server responds with IP, Port in reply (227)
– Client issues active open to server’s port
• Ultimately, the data sender closes connection
FTP Passive Data Transfer
User
Data Transfer
Function
Server
Data Transfer
Function
User
Interface
User
Protocol
Interpreter
Server
Protocol
Interpreter
client
server
Control
Connection
Data
Connection
ls client.txt
Passive open on
Port 5125
PASV
227 Entering Passive Mode (128,4,40,42,20,5)
LIST client.txt
150 Data Connection will be open shortly
226 Closing Data Connection
-rw-r--r-- lucasb client.txt
Establish Data Connection
User
Protocol
Interpreter
Server
Protocol
Interpreter
Trivial FTP (TFTP)
• Used only to read and
write files from/to a
remote server
– Cannot list directories
• Useful for
bootstrapping diskless
systems
– Workstations
– X terminals
TFTP
UDP
IP
Ethernet
Physical
TFTP Message Formats
Diagrams from McGraw-Hill
TFTP Connection Establishment
Diagram from McGraw-Hill
TFTP Data Transfer
Diagram from McGraw-Hill
TFTP Connection
Read Request RRQ “fullOS”
DATA 1
ACK 1
Timeout
ACK 2
Client Server
DATA 2
DATA 2
Timeout
ACK 3
DATA 3
DATA 3
First Block of
512 Bytes Sent
Block 2 Lost
Block 3 Damaged
ACK 4
DATA 4
Timeout
ACK 4
ACK 4 Lost
Eph
69
Eph
Timer
running
TFTP Connection (cont’d)
DATA 5
ACK 5
Timeout
Client Server
DATA 5
ACK 5 DATA 6
ACK 6 DATA 6
ACK 6 DATA 7
ACK 7 DATA 7
ACK 7 DATA 8
ACK 8 DATA 8
ACK 8
Block 8 is the Last
Block (383 Bytes)
ACK 5 is Slow
Discard Duplicate
Resend Data 6
Data is Sent
Twice, Known as
The Sorcerer's
Apprentice Bug
FTP vs. TFTP
FTP TFTP
2 connections: control
(21) and data (20)
1 connection (69), stop
and wait flow
Reliable service using
TCP
Uses UDP, handles own
retransmissions
Many commands 5 message types, only
reads/writes files
Minimal security using
logon procedure
No logon or security
Larger code size, full-
featured
Lightweight, designed to
fit on ROM

More Related Content

Similar to ftp.07f.ppt

Computer network
Computer networkComputer network
Computer networkPihu Goel
 
Group20 Dynamic Networks
Group20 Dynamic NetworksGroup20 Dynamic Networks
Group20 Dynamic Networkshariprasadnr
 
File transfer protocol (ftp) in application
File transfer protocol (ftp) in applicationFile transfer protocol (ftp) in application
File transfer protocol (ftp) in applicationRochakSrivastava3
 
File Transfer Protocol (FTP)
File Transfer Protocol (FTP)File Transfer Protocol (FTP)
File Transfer Protocol (FTP)AxelXrest
 
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptxZahouAmel1
 
File Transfer Protocol
File Transfer ProtocolFile Transfer Protocol
File Transfer Protocolguest029bcd
 
Using an FTP client - Client server computing
Using an FTP client -  Client server computingUsing an FTP client -  Client server computing
Using an FTP client - Client server computinglordmwesh
 
File tranfer protocol
File tranfer protocolFile tranfer protocol
File tranfer protocolKunalThorat9
 
File transfer protocol
File transfer protocolFile transfer protocol
File transfer protocolAmandeep Kaur
 
SquirrelMail for webmail
SquirrelMail for webmailSquirrelMail for webmail
SquirrelMail for webmailAryman Gautam
 
Computer network (10)
Computer network (10)Computer network (10)
Computer network (10)NYversity
 

Similar to ftp.07f.ppt (20)

FTP(In_Linux).pptx
FTP(In_Linux).pptxFTP(In_Linux).pptx
FTP(In_Linux).pptx
 
F T P
F T PF T P
F T P
 
Computer network
Computer networkComputer network
Computer network
 
Ft pv2(1)
Ft pv2(1)Ft pv2(1)
Ft pv2(1)
 
Netkitmig
NetkitmigNetkitmig
Netkitmig
 
An overview of ftp
An overview of ftpAn overview of ftp
An overview of ftp
 
Unit 6 : Application Layer
Unit 6 : Application LayerUnit 6 : Application Layer
Unit 6 : Application Layer
 
Group20 Dynamic Networks
Group20 Dynamic NetworksGroup20 Dynamic Networks
Group20 Dynamic Networks
 
File transfer protocol (ftp) in application
File transfer protocol (ftp) in applicationFile transfer protocol (ftp) in application
File transfer protocol (ftp) in application
 
File Transfer Protocol
File Transfer ProtocolFile Transfer Protocol
File Transfer Protocol
 
File Transfer Protocol (FTP)
File Transfer Protocol (FTP)File Transfer Protocol (FTP)
File Transfer Protocol (FTP)
 
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
4-Lect_4-2.pptx4-Lect_4-2.pptx4-Lect_4-2.pptx
 
File Transfer Protocol
File Transfer ProtocolFile Transfer Protocol
File Transfer Protocol
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
 
Using an FTP client - Client server computing
Using an FTP client -  Client server computingUsing an FTP client -  Client server computing
Using an FTP client - Client server computing
 
Ftp
FtpFtp
Ftp
 
File tranfer protocol
File tranfer protocolFile tranfer protocol
File tranfer protocol
 
File transfer protocol
File transfer protocolFile transfer protocol
File transfer protocol
 
SquirrelMail for webmail
SquirrelMail for webmailSquirrelMail for webmail
SquirrelMail for webmail
 
Computer network (10)
Computer network (10)Computer network (10)
Computer network (10)
 

More from aozcan1

6920161.ppt
6920161.ppt6920161.ppt
6920161.pptaozcan1
 
ge6075-unit-2.ppt
ge6075-unit-2.pptge6075-unit-2.ppt
ge6075-unit-2.pptaozcan1
 
ELG2911Modul2EthicalPractice.pptx
ELG2911Modul2EthicalPractice.pptxELG2911Modul2EthicalPractice.pptx
ELG2911Modul2EthicalPractice.pptxaozcan1
 
estimation.ppt
estimation.pptestimation.ppt
estimation.pptaozcan1
 
Teregowda.ppt
Teregowda.pptTeregowda.ppt
Teregowda.pptaozcan1
 
16223434.ppt
16223434.ppt16223434.ppt
16223434.pptaozcan1
 
application-layer.ppt
application-layer.pptapplication-layer.ppt
application-layer.pptaozcan1
 
meng.ppt
meng.pptmeng.ppt
meng.pptaozcan1
 
lect2a.ppt
lect2a.pptlect2a.ppt
lect2a.pptaozcan1
 
02mathematics.ppt
02mathematics.ppt02mathematics.ppt
02mathematics.pptaozcan1
 
01introduction.ppt
01introduction.ppt01introduction.ppt
01introduction.pptaozcan1
 
Angel6E01.pptx
Angel6E01.pptxAngel6E01.pptx
Angel6E01.pptxaozcan1
 
Computer_Graphics_chapter-1.pptx
Computer_Graphics_chapter-1.pptxComputer_Graphics_chapter-1.pptx
Computer_Graphics_chapter-1.pptxaozcan1
 
901350_S01.ppt
901350_S01.ppt901350_S01.ppt
901350_S01.pptaozcan1
 

More from aozcan1 (15)

6920161.ppt
6920161.ppt6920161.ppt
6920161.ppt
 
ge6075-unit-2.ppt
ge6075-unit-2.pptge6075-unit-2.ppt
ge6075-unit-2.ppt
 
bgp.ppt
bgp.pptbgp.ppt
bgp.ppt
 
ELG2911Modul2EthicalPractice.pptx
ELG2911Modul2EthicalPractice.pptxELG2911Modul2EthicalPractice.pptx
ELG2911Modul2EthicalPractice.pptx
 
estimation.ppt
estimation.pptestimation.ppt
estimation.ppt
 
Teregowda.ppt
Teregowda.pptTeregowda.ppt
Teregowda.ppt
 
16223434.ppt
16223434.ppt16223434.ppt
16223434.ppt
 
application-layer.ppt
application-layer.pptapplication-layer.ppt
application-layer.ppt
 
meng.ppt
meng.pptmeng.ppt
meng.ppt
 
lect2a.ppt
lect2a.pptlect2a.ppt
lect2a.ppt
 
02mathematics.ppt
02mathematics.ppt02mathematics.ppt
02mathematics.ppt
 
01introduction.ppt
01introduction.ppt01introduction.ppt
01introduction.ppt
 
Angel6E01.pptx
Angel6E01.pptxAngel6E01.pptx
Angel6E01.pptx
 
Computer_Graphics_chapter-1.pptx
Computer_Graphics_chapter-1.pptxComputer_Graphics_chapter-1.pptx
Computer_Graphics_chapter-1.pptx
 
901350_S01.ppt
901350_S01.ppt901350_S01.ppt
901350_S01.ppt
 

Recently uploaded

Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 

Recently uploaded (20)

Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 

ftp.07f.ppt

  • 1. FTP - File Transfer Protocol TFTP – Trivial FTP CISC 856 – Fall 2007 Brian Lucas University of Delaware (some/most slides courtesy of Umakanth Puppala, William Boyer Vikram Rajan, Michael Haggerty, and Prof Amer) lucasb@capsl.udel.edu
  • 2. Overview File Transfer Protocol (RFC 959) • Why FTP? • FTP’s connections • FTP in action • FTP commands/responses Trivial File Transfer Protocol (RFC 1350) • TFTP and TFTP’s message formats • FTP and TFTP compared
  • 3. Why do we need a FTP Service? Purpose: To Transfer files between two computers Goals of FTP Service • Promote sharing of files (programs and/or data) • Encourage indirect/implicit use of remote computers • Shield users from variations in file storage among hosts • Transfer data reliably and efficiently
  • 4. Problems of File Transfer • At first, file transfer may seem simple • Heterogeneous systems use different: – Operating Systems – Character Sets – Naming Conventions – Directory Structures – File Structures and Formats • FTP needs to address and resolve these problems
  • 5. FTP’s Connections User Interface User Data Transfer Function User Protocol Interpreter Server Protocol Interpreter Server Data Transfer Function client server Control Connection Data Connection * Insulates users from “raw” FTP commands Server is listening on port 21 for connection requests 2 * Routes “raw” FTP commands * Receives server’s replies * Persistent command and reply connection Non-persistent data connection 21 20 *Server uses port 20 for data connections
  • 6. FTP’s Connections – Establishment User Interface User Data Transfer Function User Protocol Interpreter Server Protocol Interpreter Server Data Transfer Function client server Control Connection Data Connection 2 ftp> open strauss.udel.edu Connected to strauss.udel.edu 220 strauss FTP server ready. USER lucasb 331 Password req for lucasb. Password: PASS mypass 230 User lucasb logged in. ftp>
  • 7. 128.4.40.17 (19×256)+137 128.4.40.17:5001 User Data Transfer Function Server Data Transfer Function User Interface User Protocol Interpreter Server Protocol Interpreter client server Control Connection Data Connection 2 ls client.txt Passive open on Port 5001 PORT 128,4,40,17,19,137 200 Port Command Sucessful LIST client.txt 150 Data Connection will be open shortly 226 Closing Data Connection -rw-r--r-- lucasb client.txt Establish Data Connection User Protocol Interpreter Server Protocol Interpreter FTP’s Connections Data Transfer 128.4.40.17 19,137
  • 9. FTP Connection ftp> open server SYN SYN|ACK ACK 220 Service Ready ftp> USER lucasb ACK ACK 331 User OK,password? ACK ftp> PASS mypass ACK 230 User login OK ACK Client Server 21 Eph
  • 10. FTP Data Transfer PORT 128,4,40,17,19,137 200 Command Successful LIST client.txt ACK 150 Data Connection will be open shortly 226 Closing Data Connection ACK ACK Control connection Data Connection Client Server Eph Eph 21 21 5001 20 5001 20
  • 11. FTP Client Commands (issued by user interface) Command Description get filename Retrieve file from server mget filename* Retrieve multiple files from server* put filename Copy local file to server mput filename* Copy multiple local files to server* open server Begin login to server bye / close / exit Logoff server ls / dir List files in current remote dir on server lcd Change local directory cd Change remote directory rhelp / remotehelp Lists commands the server accepts * Sent to server as multiple command by User Protocol Interpreter
  • 12. A-PDU FTP Commands Command Description LIST [filelist ] List files or directories (ls / dir) USER username Send username to server PASS password Password on server PORT h1,h2,h3,h4,p1,p2 Client IP and port number RETR filename Retrieve (get) filename STOR filename Store (put) filename TYPE (A, I, E, N or T) Defines the file type or print format
  • 13. FTP Response format Reply Description 1yz 2yz 3yz 4yz 5yz Positive preliminary reply.The action is being started but expect another reply before sending another cmd. Positive completion reply. A new cmd can be sent. Positive intermediate reply. The cmd has been accepted but another cmd must be sent. Transient negative completion reply. The requested action did not take place but can be sent later Permanent negative completion reply. Cmd not accepted and should not be reissued. x0z x1z x2z x3z x4z x5z Syntax errors Information Connections. Replies referring to control or data connections. Authentication and accounting Unspecified Filesystem status
  • 14. Example FTP Responses • 120 Service will be ready shortly • 200 Command OK • 230 User login OK • 331 User name OK; password is needed • 421 Service not available • 530 User not logged in • 552 Requested action aborted; exceeded storage allocation
  • 15. Summary of FTP connections • FTP has 2 connections - Control (persistent connection) - Server issues a passive open on well-known 21 - Client uses an ephemeral port to issue active open - Server ultimately closes control connection - Data (ephemeral connection) - Client issues passive open on an ephemeral port - Client sends this port to server via PORT command - Server receives the port number and issues active open using its well-known 20 to the received ephemeral port
  • 16. Data Connection • Connection does not always work…why? • Instead, use PASV command – Client sends PASV command to server – Server chooses ephemeral port: passive open – Server responds with IP, Port in reply (227) – Client issues active open to server’s port • Ultimately, the data sender closes connection
  • 17. FTP Passive Data Transfer User Data Transfer Function Server Data Transfer Function User Interface User Protocol Interpreter Server Protocol Interpreter client server Control Connection Data Connection ls client.txt Passive open on Port 5125 PASV 227 Entering Passive Mode (128,4,40,42,20,5) LIST client.txt 150 Data Connection will be open shortly 226 Closing Data Connection -rw-r--r-- lucasb client.txt Establish Data Connection User Protocol Interpreter Server Protocol Interpreter
  • 18. Trivial FTP (TFTP) • Used only to read and write files from/to a remote server – Cannot list directories • Useful for bootstrapping diskless systems – Workstations – X terminals TFTP UDP IP Ethernet Physical
  • 19. TFTP Message Formats Diagrams from McGraw-Hill
  • 21. TFTP Data Transfer Diagram from McGraw-Hill
  • 22. TFTP Connection Read Request RRQ “fullOS” DATA 1 ACK 1 Timeout ACK 2 Client Server DATA 2 DATA 2 Timeout ACK 3 DATA 3 DATA 3 First Block of 512 Bytes Sent Block 2 Lost Block 3 Damaged ACK 4 DATA 4 Timeout ACK 4 ACK 4 Lost Eph 69 Eph Timer running
  • 23. TFTP Connection (cont’d) DATA 5 ACK 5 Timeout Client Server DATA 5 ACK 5 DATA 6 ACK 6 DATA 6 ACK 6 DATA 7 ACK 7 DATA 7 ACK 7 DATA 8 ACK 8 DATA 8 ACK 8 Block 8 is the Last Block (383 Bytes) ACK 5 is Slow Discard Duplicate Resend Data 6 Data is Sent Twice, Known as The Sorcerer's Apprentice Bug
  • 24. FTP vs. TFTP FTP TFTP 2 connections: control (21) and data (20) 1 connection (69), stop and wait flow Reliable service using TCP Uses UDP, handles own retransmissions Many commands 5 message types, only reads/writes files Minimal security using logon procedure No logon or security Larger code size, full- featured Lightweight, designed to fit on ROM