F T P

529 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
529
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

F T P

  1. 1. File Transfer Protocol CS-328 Dick Steflik
  2. 2. FTP <ul><li>RFC 959 </li></ul><ul><li>uses two TCP Ports </li></ul><ul><ul><li>one for control </li></ul></ul><ul><ul><li>one for data transfers </li></ul></ul><ul><li>command-response protocol </li></ul><ul><li>control port uses telnet protocol to negotiate session </li></ul><ul><ul><li>US-ASCII </li></ul></ul><ul><ul><li><crlf> is end-of-line character </li></ul></ul>
  3. 3. Active Mode FTP <ul><li>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) </li></ul>Client Server 20 21 1026 1027 1 2 3 4
  4. 4. Passive Mode FTP <ul><li>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. </li></ul>Client Server 20 21 1026 1027 1 2 2024 3 4
  5. 5. Transfer Files in a Heterogeneous Host Environment <ul><li>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 </li></ul><ul><ul><li>ASCII A NVT-ASCII </li></ul></ul><ul><ul><li>EBCDIC E EBCDIC Text </li></ul></ul><ul><ul><li>IMAGE I Raw binary, series of octets </li></ul></ul><ul><ul><li>LOCAL L Raw binary using a variable byte size </li></ul></ul><ul><li>Client responsibility to tell server data type to use </li></ul><ul><li>Default data type, unless otherwise specified is ASCII </li></ul>
  6. 6. File Structures <ul><li>Operating System store files in different structures </li></ul><ul><li>FTP defined file structures for transporting files </li></ul><ul><ul><li>File F Unstructured, sequence of bytes </li></ul></ul><ul><ul><li>Record R Series of records </li></ul></ul><ul><ul><li>Page P Series of data blocks (pages) </li></ul></ul><ul><li>Default file structure is File (F) </li></ul><ul><li>File Structure specified using STRU command </li></ul>
  7. 7. Transmission Modes <ul><li>Mode is used to specify additional coding or sequencing performed on data </li></ul><ul><li>independent of data type and file structure </li></ul><ul><ul><li>Stream S stream of bytes, if record structure EOF sent as record indication; if file eof indicated by closing stream </li></ul></ul><ul><ul><li>Block B file sent as sequence of blocks preceded by header info allows restart of an interruped transfer </li></ul></ul><ul><ul><li>Compressed C data compressed using run length encoding </li></ul></ul>
  8. 8. FTP Commands <ul><li>USER R User name, userid for access control </li></ul><ul><li>PASS O Password for access control </li></ul><ul><li>ACCT O Account info </li></ul><ul><li>CWD O Change working directory </li></ul><ul><li>CDUP O Change to parent directory </li></ul><ul><li>SMNT O Structure mount, mount a different file system </li></ul><ul><li>QUIT R informs server that client wants out </li></ul><ul><li>REIN O restarts session at authentication phase </li></ul><ul><li>PORT R Host addr and data port to use </li></ul>
  9. 9. FTP Commands (more) <ul><li>PASV O Passive; informs server that client will contact to set up data connections, ask server to sent port info </li></ul><ul><li>TYPE R Data type, type of subsequent transfers </li></ul><ul><li>STRU R File structure </li></ul><ul><li>MODE R Transfer mode </li></ul><ul><li>RETR R Retrieve, download the file from server </li></ul><ul><li>STOR R Store, upload the specified to server </li></ul><ul><li>STOU O Store unique, same as store but server picks unique file name </li></ul>
  10. 10. FTP Commands (more) <ul><li>APPE O Append, upload file to server, if file name exists, append the upload </li></ul><ul><li>ALLO O Allocate, sometimes used to preallocate space </li></ul><ul><li>REST O Restart, restart an interrupted transfer </li></ul><ul><li>RNFR O Rename file from filename </li></ul><ul><li>RNTO O Rename file to </li></ul><ul><li>ABOR O Abort, ask server to abort last command </li></ul><ul><li>DELE O Delete specified file </li></ul><ul><li>RMD O Remove directory </li></ul><ul><li>MKD O Make directory </li></ul>
  11. 11. FTP Commands (more) <ul><li>PWD O Print working directory </li></ul><ul><li>LIST O Request directory listing </li></ul><ul><li>NLST O Request just a file name list </li></ul><ul><li>SITE O Site parameters, allow client to specify site specific options and parameters </li></ul><ul><li>SYST O request server operating system </li></ul><ul><li>STAT O Request server to send status of current xfr </li></ul><ul><li>HELP O general and command specific </li></ul><ul><li>NOOP R ask server to send a positive reply </li></ul>
  12. 12. FTP Responses <ul><li>Each command generates a server response </li></ul><ul><ul><li>3 digit code, text, <crlf> </li></ul></ul><ul><li>use 3 digit code as driver for GUI Clients or programatic implementations </li></ul><ul><li>use text for Command line clients </li></ul>
  13. 13. Responses <ul><li>1yz - Positive preliminary reply - command is being acted upon; expect a final reply code before sending another command </li></ul><ul><li>2yz - Positive completion reply - command was successfully executed; new command may be sent </li></ul><ul><li>3yz - Positive intermediate reply - command was accepted, but the final result is being delayed because other information needs to be supplied from the client; reply is used for sequencing command groups </li></ul><ul><li>4yz - Transient negative completion reply - command failed, but the condition is temporary </li></ul><ul><li>5yz - Permanent negative completion reply - command failed and will always fail if given again; the command should not be attempted again </li></ul>
  14. 14. Response <ul><li>x0z - Refers to command syntax </li></ul><ul><li>x1z - Indicates information returned by commands requesting information such as status or help </li></ul><ul><li>x2z - Refers to the state of the control or data connections </li></ul><ul><li>x3z - The reply is associated with the login process and accounting procedures </li></ul><ul><li>x4z - Reserved for future use </li></ul><ul><li>x5z - Refers to the state of the requested file transfer or other file system command </li></ul>

×