Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ftp.75 to 76


Published on

  • Be the first to comment

  • Be the first to like this

Ftp.75 to 76

  1. 1. Sub Topic : Introduction to File Transfer Protocol (FTP). ftp protocol with video 1
  2. 2. Recap In the previous class, you have learnt about • Post Office Protocol • Installation and configuration of POP3 connector • POP and commands and process • Limitations of POP • Internet Mail Access Protocol (IMAP) • Comparison of POP and IMAP 2
  3. 3. Objectives On completion of this class, you would be able to understand about • FTP’s connections • FTP commands and responses • FTP in action • FTP Connections • Transfer Modes 3
  4. 4. Recap of Mail ProtocolsBHARATHI SANTOSH SMTP SMTP POP3 or user user agent IMAP agent sender’s mail receiver’s mail server server Fig .1 • SMTP: delivery/storage to receiver’s mail server • Mail access protocols: retrieval from server – POP: Post Office Protocol [RFC 1939] • authorization and download – IMAP: Internet Mail Access Protocol [RFC 1730] • manipulation of stored messages on server – HTTP: Hotmail , Yahoo! Mail, etc 4
  5. 5. File Transfer Protocol (FTP)• A general-purpose protocol that can be used to copy an arbitrary file from one computer to another• one of the oldest network application---predates TCP and IP• Later versions were built on top of TCP/IP• Among the most heavily used applications – FTP generated as much as 1/3 of the traffic on the Internet – Was exceeded only by WWW (in 1995) 5
  6. 6. File Transfer Protocol• Provides reliable transfer of files • Between different hosts running on different platforms MS Windows, Apple Mac, Sun, BSD UNIX, SCO UNIX, Linux • Using different file structures • Supports ASCII and binary content Fig .2 6
  7. 7. FTP Standards• RFC 959• uses two TCP Ports – one for control – one for data transfers• command-response protocol• control port uses telnet protocol to negotiate session – US-ASCII – <crlf> is end-of-line character 7
  8. 8. Control and Data Connections• Control functions (commands) and reply codes are transferred over the control connection• All data transfer takes place over the data connection• The control connection must be “up” while data transfer takes place 8
  9. 9. Control Connection• The control connection is the “well known” service• The control connection uses the TELNET protocol• Commands and replies are all line oriented text (default is ASCII) 9
  10. 10. Standard Connection Model ControlAA Data B B Fig .3 10
  11. 11. Alternative Connection Model Control Control ABB Data C C Fig .4 11
  12. 12. Transfer Modes• FTP defines two types of transfer – textual and binary• Textual: is used for text files – most text files are encoded in ASCII or EBCDIC – ftp can translate from the local to remote character set when transferring a file• Binary: used for all other files (audio, image, numbers, …) – Files are copied exactly – The resulting copy might be meaningless because FTP does not convert values to the local representation 12
  13. 13. FTP: File Transfer Protocol FTP file transfer FTP FTP user client server interface local file remote file user system system at host Fig .5• transfer file to/from remote host• client/server model – client: side that initiates transfer (either to/from remote) – server: remote host, serves the file• ftp: RFC 959• ftp server: port 21 (well known) 13
  14. 14. Separate Control & Data Connections• ftp client contacts server at port 21, specifying TCP as the transport protocol TCP control connection port 21• Parallel TCP connections – control: exchange commands, TCP data connection responses between client and FTP port 20 FTP server client server – data: file data to/from server Fig .6• ftp server maintains “state” – current directory – earlier authentication 14
  15. 15. FTP Client CommandsCommand Descriptionget filename Retrieve file from servermget filename* Retrieve multiple files from serverput filename Copy local file to servermput filename* Copy multiple local files to serveropen server Begin login to serverbye / close / exit Logoff serverls / dir List files in current remote dir on serverlcd Change local directorycd Change remote directoryrhelp / remotehelp 15 Table 1
  16. 16. FTP Commands Command DescriptionAbor Abort previous FTP command and any data transferList [filelist ] List files or directories (ls / dir)Pass password Password on serverPort n1,n2,n3,n4,n5,n6 Client IP and port numberRetr filename Retrieve (get) filenameStor filename Store (put) filenameNoop Do nothing (check if server is alive) Table 2 16
  17. 17. FTP Response FormatReply Description 1yz Positive preliminary reply.The action is being started but expect another reply before sending another cmd 2yz Positive completion reply. A new cmd can be sent 3yz Positive intermediate reply. The cmd has been accepted but another cmd must be sent 4yz Transient negative completion reply. The requested action did not take place but can be sent later 5yz Permanent negative completion reply. Cmd not accepted and should not be reissued x0z Syntax errors x1z Information x2z Connections. Replies referring to the control or data connections x3z Authentication and accounting x4z Unspecified x5z Filesystem status Table 3 17
  18. 18. 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• 503 Bad sequence of commands• 530 User not logged in 18
  19. 19. Connections, Authorizations and File permissions • The remote system has to verify that the user is authorized to access files – The user has to provide a login name and a password – If the user is authorized he/she may start transferring files • What if the user does not have an account? – System administrator can configure FTP to support anonymous FTP – Login name anonymous and password guest (or e- mail address) allows a user access to public files 19
  20. 20. FTP uses the client-server paradigm– Local application (or browser) is the client– Remote FTP program is the server– The FTP server authorizes the connection, locates the file, and uses TCP Fig .8 to send it 20
  21. 21. Active Mode FTP• Client connect from a random unprivileged port (n > 1023) to the servers command port (21) and sends port command to tell server to connect to n+1 then listens on the next higher unprivileged port (n+1) for server responses. The server connects from it’s data port (20) to the client data port (n+1) Server Client 20 21 1026 1027 1 2 3 4 21
  22. 22. Passive Mode FTP• Client opens two random unprivileged ports ( n > 1023 and n+1; ex 1026 and 1027) and connects the first port (n) to server command port 21 and issues a pasv command (server sends port to use for data); client connects to servers specified data port, server completes connection Server Client 20 2024 21 1026 1027 1 2 3 4 22
  23. 23. Transmission Modes• Mode is used to specify additional coding or sequencing performed on data• independent of data type and file structure – Stream S stream of bytes, if record structure EOF sent as record indication; if file eof indicated by closing stream – Block B file sent as sequence of blocks preceded by header info allows restart of an interruped transfer – Compressed C data compressed using run length encoding 23
  24. 24. Transfer Files in a Heterogeneous HostEnvironment • Due to multiple hardware types and operating systems file are converted to four environmentally neutral data type for transport and the converted to local types at the destination – ASCII A NVT-ASCII – EBCDIC E EBCDIC Text – IMAGE I Raw binary, series of octets – LOCAL L Raw binary using a variable byte size • Client responsibility to tell server data type to use • Default data type, unless otherwise specified is ASCII 24
  25. 25. File Structures• Operating System store files in different structures• FTP defined file structures for transporting files – File F Unstructured, sequence of bytes – Record R Series of records – Page P Series of data blocks (pages)• Default file structure is File (F)• File Structure specified using STRU command 25
  26. 26. A Browser can use FTP• A W W W browser can be used for FTP instead of a dedicated interface• A browser uses FTP as the transfer protocol, when the URL starts with ftp (instead of http)• Example – --- instructs the browser to get file “as7656/temp” from machine – --- displays all files in the directory “as7656” 26
  27. 27. SummaryIn this class, you have learnt about • File Transfer Protocol • Commands & Responses • FTP Transfer Modes • Transaction Phase • Transmission Modes 27
  28. 28. Quiz1) FTP uses 2 TCP ports : one for data transfer and the other for____A) Control2) Control connection uses ___ protocolA) Telnet3) The FTP command used to retrieve a file from the remote computer is ___A) Get4) The remote system verifies ____ and ___ to authorize user to access filesA) login Name (or user id) and Password 28
  29. 29. Frequently Asked Questions1. Explain file transfer protocol (FTP) Home 29 ftp protocol with video