home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 200s / rfc265.txt < prev    next >
Text File  |  1997-07-01  |  25KB  |  676 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                             17 November 1971
  8. Request for Comments #265                         Abbay Bhushan, MIT
  9. NIC 781                                           Bob Braden, UCLA
  10. Categories D.4, D.5, and D.7                      Will Crowther, BBN
  11.                                                   Eric Narslem, Rand
  12. Obsoletes: 172                                    John Heafner, Rand
  13.                                                   Alex McKenzie, BBH
  14.                                                   John Melvin, SRI
  15.                                                   Bob Sundberg, Harvard
  16.                                                   Dick Watson, SRI
  17.                                                   Jim White, UOSB
  18.  
  19.  
  20.                        THE FILE TRANSFER PROTOCOL
  21.  
  22.     This Paper is a revision of RF 172, Mic 6794. The changes
  23. to RFC 172 are given below. The protocol is then restated for
  24. your ocnvenience.
  25.  
  26.                            CHANGES TO RFC 172
  27.  
  28. 1) Two new file transfer requests have been added. These are
  29.  
  30. 2) The op code assignements in control transactions have been
  31. changed to include the above requests.
  32.  
  33. 3) Two new error codes indicating 'incorrect or missing
  34. indentifier' and 'file already exists' have been added. New error
  35. code assignements reflect this change.
  36.  
  37. 4) Editorial changes to clarify specifications.
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.                                                                 [Page 1]
  59.  
  60. File Transfer Protocol          RFC 265                 17 November 1971
  61.  
  62.  
  63. I. INTRODUCTION
  64.  
  65.     The file transfer protocol (FTP) is a userlevel procotocol for
  66. file transfer between host computers (including terminal IMPs), on the
  67. ARPA computer network (ARPANET). The primary function of FTP is to
  68. facilitate transfer of files between hosts and to allow convenient use
  69. of storage and file handling capabilities of remote hosts. FTP uses
  70. the Data Transfer Protocol described in RFC 264 to achieve transfer of
  71. data. This paper assumes knowledge of RFC 264.
  72.  
  73.     The objectives of FTP are to promote sharing of files (computer
  74. programs and/or data) encourage implicit (without explicit login) use
  75. of computers, and shield the user from variations in file and storage
  76. systems of different hosts. These objetives are achieved by specifying
  77. a standard file transfer socket and initial connection protocol for
  78. implicit use, and using standard conventions for file transfer and
  79. related operations.
  80.  
  81. II. DISCUSSION
  82.  
  83.     A file is considered here to be an ordered set of arbitrary
  84. length, consisting of computer data (including programs). Files are
  85. uniquely identified in a system by their pathnames. A pathname is
  86. (loosely) defined to be the data string which must be input to the
  87. file system by a network user in order to identify a file. Pathname
  88. usually contains device and/or directory names, and file name. FTP
  89. specifications provide standard file system commands, but do not
  90. provide standard naming convention at this time. Each user must follow
  91. the naming convention of the file system be wishing to use. FTP may be
  92. extended later to include standard conventions of pathname structures.
  93.  
  94.     A file may or may not have access control associated with it The
  95. access controls designate users access privileges. In absence of
  96. access controls, files cannot be protected from accidental or
  97. unauthorized usage. It is the prerogative of a serving file system to
  98. provide protection, and selective access.  FTP provides identifier and
  99. password mechanisms for exchange of access control information. it
  100. should however ve noted, that for file sharing, it is necessary that a
  101. user be allowed (subject to access controls) to access files not
  102. created by him.
  103.  
  104.     FTP does not restrict the nature of information in files.  For
  105. example, a file could contain ASCII text, binary data, computer
  106. program, or any other information. A provision for indicating data
  107. structure (type and byte size) exists in FTP to aid in parsing,
  108. interpretation, and storage of data.
  109.  
  110.  
  111.  
  112.  
  113.  
  114.                                                                 [Page 2]
  115.  
  116. File Transfer Protocol          RFC 265                 17 November 1971
  117.  
  118.  
  119.     To facilitate impliict usage, a serving file transfer process my
  120. be a disowned "demon" process which "listens" to an agreed-upon
  121. socket, and follows the standard initial connection protocol for
  122. establishing a fill-duplex connection. It should be noted that FTP my
  123. also be used directly by logging into a remote host, and arranging for
  124. file transfer over specific sockets.
  125.  
  126.     FTP is readily extendable, in that additional commands and data
  127. types may be defined by those agreeing to implement them.
  128. Implementation of a subset of commands is specifically permitted, and
  129. an initial subset for implementation is recommended. (*)The protocol
  130. may also be extended to enable remote execution of programs, but no
  131. standard procedure is suggested.
  132.  
  133.     For transferring data, FTP uses the data transfer protocol
  134. specified in RFC 264. As the data transfer protool does not specify
  135. the manner in which it is to be used by FTP, implementation may vary
  136. at different host sites. Hosts not wishing to separate data transfer
  137. and file transfer functions, should take particular care in conforming
  138. to the data transfer protocol specifications of RFC 264.
  139.  
  140.     It should be noted that FTP specifications do not require
  141. knowledge of transfer modes used by data transfer protocol.  However,
  142. as file transfer protocol requires the transfer of more than a single
  143. control transaction over the same connection, it is essential that
  144. hosts be able to send control transactions in either 'transparent
  145. block' (type B9) or 'descriptor and counts' (type BA) modes. (Type BS,
  146. the indefinite bit stream mode is not suitable as it limits transfer
  147. to single transactions.).
  148.  
  149.     The use of data transfer aborts (type B6) is neither required, nor
  150. defined in FTP. FTP has its own error terminate wich may be used to
  151. abort a file transfer request. FTP also does not define to structure
  152. of files, and there are no conventions on the use of group, record and
  153. unit separators. (*)A file separator however, indicates the end of a
  154. file.
  155.  
  156.     It is strongly recommended that default options be provided in
  157. implementation to facilitate use of file transfer service.  For
  158. example, the main file directora on disk, a pool directory, user
  159. directory of diretory last accessed could serve as standard pathname
  160. defaults. Default mechanisms are convenient, as the user doesn't have
  161. to specify the complete pathname each time ve wishes to use the file
  162. transfer service. No standard default procedures are specified by FTP.
  163.  
  164. --------------------------------
  165. (*)
  166.     This initial subset represents control functions necessary for
  167.  
  168.  
  169.  
  170.                                                                 [Page 3]
  171.  
  172. File Transfer Protocol          RFC 265                 17 November 1971
  173.  
  174.  
  175. basic file transfer and "mail" operations, and some elementary file
  176. manipulation operations. There is no attempt to provide a data
  177. management or complete file management cpability.
  178. (*)
  179.     It is possible that wi may, at a later date, assign meaning to
  180. these information separators within FTP.
  181.  
  182. III. SPECIFICATIONS
  183.  
  184. 1.  Data Transfer
  185.  
  186.     FTP uses the Data Transfer Protocol (described in RFC 264)
  187.     for transferring data and/or control transaction. Both data
  188.     and control transactions are communicated over the same
  189.     connection.
  190.  
  191. 2.  Data Transactions
  192.  
  193.     Data transactions represent the data contained in a file.
  194.     There is no data type or byte size information contained in
  195.     data transactions. The structure of data communicated via
  196.     control transactions. A file may be transferred as one or
  197.     more data transactions. The protocol neither specifies nor
  198.     impose any limitations on the structure (record, group, etc)
  199.     or length of file. Such limitations may however be imposed
  200.     by a serving host. the end of a file may be indicated by a
  201.     file separator (as defined in data transfer protocol). In
  202.     the special case of indefinite bit-stream transfer mode (Type
  203.     B0), the end of file is indicated by closing connection. In
  204.     particular, a serving or usin host should not send the ETX,
  205.     or other end of file character, unless such a character is
  206.     part of the data in file (i.e. not provided by system).
  207.  
  208. 3.  Control Transactions
  209.  
  210.     The control transactions may be typified as requests,
  211.     identifiers, and terminates. A request fulfillment sequence
  212.     begins with a request and ends with receipt of data (followed
  213.     by end-of-File) or a terminate. The user side initiates the
  214.     connections as well as the request. The server side "listens"
  215.     and complies with the request.
  216.  
  217. 3A. Op Codes
  218.  
  219.     The first information (i.e., not descriptor) byte or control
  220.     transactions indicates the control function. This byte is
  221.     referred to as "opcode". A standard set of opcodes are
  222.     defined below. The operations are discussed in Section 2B.2.
  223.  
  224.  
  225.  
  226.                                                                 [Page 4]
  227.  
  228. File Transfer Protocol          RFC 265                 17 November 1971
  229.  
  230.  
  231.     Implementation of a workable subset (*) of opcodes is
  232.     specifically permitted. Additional standard opcodes may be
  233.     assigned later. Opcodes hex 5A (octal 100) through hex FF
  234.     (octal 377) are for experimental use.
  235.  
  236.      Op Code                          Operation
  237.     Hex   Octal
  238.  
  239.     00    000                  Set data type identifier
  240.  
  241.     01    001                  Retrieve Request
  242.  
  243.     02    002                  Create request (write file; error ir
  244.                                file already exits)
  245.  
  246.     03    003                  Store request (write file; replace
  247.                                if file already exists)
  248.  
  249.     04    004                  Append request (add to existing file;
  250.                                error if file does not exist)
  251.  
  252.     05    005                  Append_with_create request (add to
  253.                                file; create if file does not exist)
  254.  
  255.     06    006                  Delete request (delete file)
  256.  
  257.     07    007                  Rename_from request (change file name)
  258.  
  259.     08    010                  Rename_to request (the new file name)
  260.  
  261.     09    011                  List request (list information)
  262.  
  263.     0A    012                  Username identifier (for access control)
  264.  
  265.     0B    013                  Password identifier (for access control)
  266.  
  267.     0C    014                  Error of unsuccessful terminate
  268.  
  269.     0D    015                  Acknowledge or successful terminate
  270.  
  271.     0E    016
  272. through  through               Reserved for standard assignment
  273.     4F    077
  274.  
  275.     5A    100
  276. through  through               Assigned for experimental use
  277.     FF    377
  278.  
  279.  
  280.  
  281.  
  282.                                                                 [Page 5]
  283.  
  284. File Transfer Protocol          RFC 265                 17 November 1971
  285.  
  286.  
  287. ------------------------------------
  288. (*)
  289.     A workable subset is any request, plus terminates.  Indentifiers
  290. may be required in addition for usin "protected" file systems.
  291.  
  292. 3B. Syntax and Semantics
  293.  
  294. 3B.1 Data Types
  295.  
  296.     The 'set data type' control transactions indentifies the structure
  297.     of data (data type and byte size) is succeeding data transactions.
  298.     The 'set data type' transaction shall contain two more bytes in
  299.     addition to the opcode byte. The first of these bytes shall convey a
  300.     data type or code information and the second byte may convey the
  301.     data byte size, where applicable. this information may be used to
  302.     define the manner in which data is to be parsed, interpreted,
  303.     reconfigured or stored. Set data type need be sent only when
  304.     structure of data is changed from the preceding.
  305.  
  306.     Although, a number of data types are defined, specific
  307.     implementations may handle only limited data types or completely
  308.     ignore the data type and byte size descriptors.  Even if a host
  309.     process does not "recognize" a data type, it must accept data (i.e.,
  310.     there is no such thing as data type error.) These descriptors are
  311.     provided only for convenience, and it es not essential that they be
  312.     used. The standard default is to assume nothing about the
  313.     information and treat it as a bit stream (binary data, byte size
  314.     1)(*)whose interpretation is left to a higher level process, or the
  315.     user.
  316.  
  317.     The following data type codes are currently assigned. Where a byte
  318.     size is not implicit in data type, it may be provided by the second
  319.     byte.
  320.  
  321. -----------------------------------
  322.     (*)
  323.    It is, however, possible that this bit stream is treated like ASCII
  324. characters in specific instances such as transmitting a file to a line
  325. printer.
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.                                                                 [Page 6]
  339.  
  340. File Transfer Protocol          RFC 265                 17 November 1971
  341.  
  342.  
  343.       Code          Implicit          Data Type
  344.   Hex    Octal      Byte Size
  345.  
  346.   00     000           1             Bit stream (standard default)
  347.  
  348.   01     001         none            Binary data bytes
  349.  
  350.   02     002           8             Network ASCII characters
  351.  
  352.   03     003           8             EBCDIC characters
  353.  
  354.   04     004          36             DEC-packed ASCII (five 7-bit
  355.                                      characters, 36th bit 1 or 0)
  356.  
  357.   05     005           8             Decimal numbers, net. ASCII
  358.  
  359.   06     006           8             Octal numbers, net. ASCII
  360.  
  361.   07     007           8             Hexadecimal numbers, net. ASCII
  362.  
  363.   08     010
  364. through  through                     Reserved for standard assignemt
  365.   4f     077
  366.  
  367.   5A     100
  368. through  through                     Assigned for experimental use
  369.   FF     377
  370.  
  371. 3B.2 Requests and Identifiers
  372.  
  373.     Retrieve, create, append, append_with_create, delete, rename_from,
  374.     and rename_to requests must contain a pathname specifying a file,
  375.     following the opcode in the information field. In the list request a
  376.     pathname may or may not follow the opcode. If present, the pathname
  377.     may specify either a file or a directory.
  378.  
  379.     A file pathname must uniquely identify a file in the serving host.
  380.     The syntax of pathnames and identifying information shall conform to
  381.     serving host conventions, except that standard network ASCII (7-bit
  382.     ASCII right justified in 8-bit) field with most signifcant bit as
  383.     zero) shall be used.
  384.  
  385.     The store request has a 4-byte (32 bits) 'allocate size' field
  386.     followed by a pathname specifying a file. 'Allocate size' indicates
  387.     the number of bits of storage to be allocated to the file. An
  388.     allocate size of zero indicates that server should use his default.
  389.  
  390.  
  391.  
  392.  
  393.  
  394.                                                                 [Page 7]
  395.  
  396. File Transfer Protocol          RFC 265                 17 November 1971
  397.  
  398.  
  399.     Retrieve request achieves the transfer of a copy of file specified
  400.     in pathname, from serving to using host. the status and contents of
  401.     file in serving host should be unaffected.
  402.  
  403.     Create request causes a file to be created at the serving host as
  404.     specified in pathname,  A copy of the file is transferred from the
  405.     using to the serving host. If the file specified in pathname already
  406.     exists at the serving host, an error terminate should be sent by the
  407.     server.
  408.  
  409.     Store request achieves the transfer of copy of file from using to
  410.     serving host. If file specified in pathname exists on serving hosts,
  411.     then its contents shall be replaced by the contents of the file
  412.     being transferred. A new file is created at the serving host if the
  413.     file specified in pathname does not exist.
  414.  
  415.     Append request achieves the transfer of data from using to serving
  416.     host. The transferred data is appended to file specified in
  417.     pathname, at serving host. If the specified file does not exist at
  418.     serving host, an error terminate should be sent by the server.
  419.  
  420.     Append with create request achieves the transfer of data from using
  421.     to serving host. If file specified is pathname exists at serving
  422.     host, then the transferred data is appended to that file, otherwise
  423.     the file specified in pathname is created at the serving host.
  424.  
  425.     Rename from and rename to requests cause the name of the file
  426.     specified in pathname of rename_from to be changed to the name
  427.     specified in pathname of rename_to. A rename_from request must
  428.     always be followed by a rename_to request.
  429.  
  430.     Delete request causes file specified in pathname to be deleted from
  431.     the serving host. If an extra level of protection is desired such as
  432.     the query "Do you really wish to delete this file?", it is to be a
  433.     local implementation option in the using system. Such queries should
  434.     not be transmitted over network connections.
  435.  
  436.     List request causes a list to be sent from the serving to using
  437.     host. If there is no pathname of if pathname is a directory, the
  438.     server should send a file directory list. If the pathname specifies
  439.     a file then server should send current information on the file.
  440.  
  441.     Username and password identifiers contain the respective identifying
  442.     information. Normally, the information will be supplied by the user
  443.     of the file transfer service. These identifiers will normally be
  444.     sent at the start of connetion for access control.
  445.  
  446.  
  447.  
  448.  
  449.  
  450.                                                                 [Page 8]
  451.  
  452. File Transfer Protocol          RFC 265                 17 November 1971
  453.  
  454.  
  455. 3B.3  Error and Acknowledge Terminates
  456.  
  457.     The error transactions may have an error code indicated by the
  458.     second information byte. Transmission of an ASCII error message in
  459.     subsequent bytes is permitted with all error codes, except that with
  460.     Hex '0A' error code, ASCII text is required. The errors here relate
  461.     to file transfer functions only. Data synchronization and related
  462.     errors in data transfer are to be handled at the DTP level. The
  463.     following error codes are currently defined:
  464.  
  465.     Error Code (2nd descriptor byte)      Meaning
  466.    Hex     Octal
  467.    00      000                Error condition indicated by
  468.                               computer system (external to protocol)
  469.    01      001                Name syntay error
  470.    02      002                Access control violation
  471.    03      003                Abort (by user)
  472.    04      004                Allocate size too big
  473.    05      005                Allocate size overflow
  474.    06      006                Improper order for transactions
  475.    07      007                Opcode not implemented
  476.    08      010                File search failed
  477.    09      011                Incorrect or missing identifier
  478.    0A      012                Error described in text message
  479.                               (ASCII characters follow code)
  480.    0B      013                File already exists (in create request)
  481.  
  482.     At present, no completion codes are defined for acknowledge,
  483.     It is assumed that acknowledge refers to the current request
  484.     being fulfilled.
  485.  
  486. 4.  Order of transactions
  487.  
  488. 4A. A certain order of transactions must be maintained in
  489.     fulfilling file transfer requests. The exact sequence in
  490.     wich transactions occur depends on the type of request, as
  491.     described in action 4B. The fullfillment of a request may be
  492.     aborted anytime by either host, as explained in section 4C.
  493.  
  494. 4B. Identifier transactions (set data type, username, and
  495.     password) may be sent by user at any time. The usual order
  496.     would be a username transaction followed by a password
  497.     transaction at the start of the connection. No acknowledge
  498.     is required, or permitted. The identifiers are to be used
  499.     for default handling, and access control.
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.                                                                 [Page 9]
  507.  
  508. File Transfer Protocol          RFC 265                 17 November 1971
  509.  
  510.  
  511.     Retrieve and list requests cause cause the transfer of file from
  512.     server to user. After a complete file has been transferred, the
  513.     server should indicate end-of-file (by sending CLS or file
  514.     separator) to complete the request fulfillment sequence, as shown
  515.     below.
  516.  
  517.                     Retrieve / List requests
  518.                   ----------------------------->
  519.  
  520.     User                 < File -- Data>            Server
  521.                   <-----------------------------
  522.                     End of file indication
  523.                   <-----------------------------
  524.  
  525.     Store, create, append, and append_with_create requests cause
  526.     the transfer of file from user to server. After a complete
  527.     file has been transferred, the user should send an
  528.     end-of-file indication. The receipt of the file must be
  529.     acknowledged by the server, as shown below.
  530.  
  531.            Create / Store / Append / Append_with_create requests
  532.                   ----------------------------->
  533.     User                 <File --- Data>            Server
  534.                   ----------------------------->
  535.                    End of file indication
  536.                   ----------------------------->
  537.                     Acknowledge
  538.                   <-----------------------------
  539.  
  540.     Rename_from request must be followed by a rename_to request.
  541.     The request must be acknowledged as shown below.
  542.  
  543.     User              Rename_from request           Server
  544.                   ----------------------------->
  545.                       Rename_ro request
  546.                   ----------------------------->
  547.                       Acknowledge
  548.                   <-----------------------------
  549.  
  550.     The delete request requires the server to acknowledge it, as
  551.     shown below.
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.                                                                [Page 10]
  563.  
  564. File Transfer Protocol          RFC 265                 17 November 1971
  565.  
  566.  
  567.     User                   Delete                   Server
  568.                   ----------------------------->
  569.                       Acknowledge
  570.                   <-----------------------------
  571.  
  572.     Error transactions my be sent by either host at any time,
  573.     and these terminate the current request fulfillment sequence.
  574.  
  575. 4C. Aborts. Eithe host may abort a request fulfillment sequence
  576.     at any time by sending an error terminate, or by closing the
  577.     connection (NCP to transmit a CCLS for the connection). CLS
  578.     is a more drastic type of abort and shall be used when there
  579.     is a catastrophic failure, or when abort is desired in the
  580.     middle of a long transaction. The abort indicates to the
  581.     receiving host that sender of abort wishes to terminate
  582.     request fulfillment and is now ready to initiate ar fulfill
  583.     new requests. When CLS is used to abort, the using host will
  584.     he responsible for reopening connection. The file transfer
  585.     abort described here is different form data transfer
  586.     abort which is sent only by the sender of data. The use of
  587.     the data transfer is not defined in this protocol.
  588.  
  589. 5.  Initial Connection, CLS, and Access Control
  590.  
  591. 5A. Socket 3 is the standard preassigned socket number on which
  592.     the cooperating file transfer process at the serving host
  593.     should "listen". (*)The connection establishment will be in
  594.     accordance with the standard initial connection
  595.     protocol, (*)establishing a full-duplex connection.
  596.  
  597. 5B. The connection will be broken by trading a CLS between the
  598.     NCP's for each of the two connections. Normally, the user
  599.     will initiate CLS.
  600.  
  601.     CLS may also be used by either user or server, to abort a
  602.     transation in the middle. If CLS is received in the middle
  603.     of transaction, the current request fulfillment sequence will
  604.     be aborted. The using host will then reopen connection.
  605.  
  606. 5C. It is recommended that identifier (user name and password)
  607.     transactions be sent by user to server, at the start, as this
  608.     would facilitate default handline and access control for the
  609.     entire duration of connection. Some service sites may
  610.     require the indentifier transactions. The identifier
  611.     transactions do not require or permit an acknowledge, and the
  612.     user can proceed directly with requests. If the identifier
  613.     information is incorrect or not received, the server may send
  614.     an error transaction indicating access control, violation,
  615.  
  616.  
  617.  
  618.                                                                [Page 11]
  619.  
  620. File Transfer Protocol          RFC 265                 17 November 1971
  621.  
  622.  
  623.     upon subsequent requests.
  624.  
  625.     ---------------------------------
  626.     (*)
  627.        Socket 1 has been assigned to logger, socket 3 seems a
  628.     reasonable choice for File Transfer.
  629.  
  630.     (*)
  631.        RFC 165, or any subsequent standard applicable in initial
  632.     connection to loggers.
  633.  
  634.          [ This RFC was put into machine readable form for entry ]
  635.           [ into the online RFC archives by Gottfried Janik 7/97 ]
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.                                                                [Page 12]
  675.  
  676.