tech-invite   World Map     

IETF     RFCs     Groups     SIP     ABNFs    |    3GPP     Specs     Glossaries     Architecture     IMS     UICC    |    search

RFC 0765

 
 
 

File Transfer Protocol specification

Part 2 of 3, p. 20 to 43
Prev RFC Part       Next RFC Part

 


prevText      Top       Page 20 
            Replicated Byte:

                 2       6               8
               +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
               |1 0|     n     | |       d       |
               +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+

            A string of n filler bytes can be compressed into a single
            byte, where the filler byte varies with the representation
            type.  If the type is ASCII or EBCDIC the filler byte is
            <SP> (Space, ASCII code 32., EBCDIC code 64).  If the type
            is Image or Local byte the filler is a zero byte.

            Filler String:

                 2       6
               +-+-+-+-+-+-+-+-+
               |1 1|     n     |
               +-+-+-+-+-+-+-+-+

            The escape sequence is a double byte, the first of which is
            the escape byte (all zeros) and the second of which contains
            descriptor codes as defined in Block mode.  The descriptor
            codes have the same meaning as in Block mode and apply to
            the succeeding string of bytes.

            Compressed mode is useful for obtaining increased bandwidth
            on very large network transmissions at a little extra CPU
            cost.  It can be most effectively used to reduce the size of
            printer files such as those generated by RJE Hosts.

   ERROR RECOVERY AND RESTART

      There is no provision for detecting bits lost or scrambled in data
      transfer; this level of error control is handled by the TCP.
      However, a restart procedure is provided to protect users from
      gross system failures (including failures of a Host, an
      FTP-process, or the underlying network).

      The restart procedure is defined only for the block and compressed
      modes of data transfer.  It requires the sender of data to insert
      a special marker code in the data stream with some marker
      information.  The marker information has meaning only to the
      sender, but must consist of printable characters in the default or
      negotiated language of the TELNET connection (ASCII or EBCDIC).
      The marker could represent a bit-count, a record-count, or any

Top       Page 21 
      other information by which a system may identify a data
      checkpoint.  The receiver of data, if it implements the restart
      procedure, would then mark the corresponding position of this
      marker in the receiving system, and return this information to the
      user.

      In the event of a system failure, the user can restart the data
      transfer by identifying the marker point with the FTP restart
      procedure.  The following example illustrates the use of the
      restart procedure.

      The sender of the data inserts an appropriate marker block in the
      data stream at a convenient point.  The receiving Host marks the
      corresponding data point in its file system and conveys the last
      known sender and receiver marker information to the user, either
      directly or over the TELNET connection in a 110 reply (depending
      on who is the sender).  In the event of a system failure, the user
      or controller process restarts the server at the last server
      marker by sending a restart command with server's marker code as
      its argument.  The restart command is transmitted over the TELNET
      connection and is immediately followed by the command (such as
      RETR, STOR or LIST) which was being executed when the system
      failure occurred.

FILE TRANSFER FUNCTIONS

   The communication channel from the user-PI to the server-PI is
   established by a TCP connection from the user to a standard server
   port.  The user protocol interpreter is responsible for sending FTP
   commands and interpreting the replies received; the server-PI
   interprets commands, sends replies and directs its DTP to set up the
   data connection and transfer the data.  If the second party to the
   data transfer (the passive transfer process) is the user-DTP then it
   is governed through the internal protocol of the user-FTP Host; if it
   is a second server-DTP then it is governed by its PI on command from
   the user-PI.  The FTP replies are discussed in the next section.  In
   the description of a few of the commands in this section it is
   helpful to be explicit about the possible replies.

   FTP COMMANDS

      ACCESS CONTROL COMMANDS

         The following commands specify access control identifiers
         (command codes are shown in parentheses).

Top       Page 22 
         USER NAME (USER)

            The argument field is a TELNET string identifying the user.
            The user identification is that which is required by the
            server for access to its file system.  This command will
            normally be the first command transmitted by the user after
            the TELNET connections are made (some servers may require
            this).  Additional identification information in the form of
            a password and/or an account command may also be required by
            some servers.  Servers may allow a new USER command to be
            entered at any point in order to change the access control
            and/or accounting information.  This has the effect of
            flushing any user, password, and account information already
            supplied and beginning the login sequence again.  All
            transfer parameters are unchanged and any file transfer in
            progress is completed under the old account.

         PASSWORD (PASS)

            The argument field is a TELNET string identifying the user's
            password.  This command must be immediately preceded by the
            user name command, and, for some sites, completes the user's
            identification for access control.  Since password
            information is quite sensitive, it is desirable in general
            to "mask" it or suppress typeout.  It appears that the
            server has no foolproof way to achieve this.  It is
            therefore the responsibility of the user-FTP process to hide
            the sensitive password information.

         ACCOUNT (ACCT)

            The argument field is a TELNET string identifying the user's
            account.  The command is not necessarily related to the USER
            command, as some sites may require an account for login and
            others only for specific access, such as storing files.  In
            the latter case the command may arrive at any time.

            There are reply codes to differentiate these cases for the
            automaton: when account information is required for login,
            the response to a successful PASSword command is reply code
            332.  On the other hand, if account information is NOT
            required for login, the reply to a successful PASSword
            command is 230; and if the account information is needed for
            a command issued later in the dialogue, the server should

Top       Page 23 
            return a 332 or 532 reply depending on whether he stores
            (pending receipt of the ACCounT command) or discards the
            command, respectively.

         REINITIALIZE (REIN)

            This command terminates a USER, flushing all I/O and account
            information, except to allow any transfer in progress to be
            completed.  All parameters are reset to the default settings
            and the TELNET connection is left open.  This is identical
            to the state in which a user finds himself immediately after
            the TELNET connection is opened.  A USER command may be
            expected to follow.

         LOGOUT (QUIT)

            This command terminates a USER and if file transfer is not
            in progress, the server closes the TELNET connection.  If
            file transfer is in progress, the connection will remain
            open for result response and the server will then close it.
            If the user-process is transferring files for several USERs
            but does not wish to close and then reopen connections for
            each, then the REIN command should be used instead of QUIT.

            An unexpected close on the TELNET connection will cause the
            server to take the effective action of an abort (ABOR) and a
            logout (QUIT).

      TRANSFER PARAMETER COMMANDS

         All data transfer parameters have default values, and the
         commands specifying data transfer parameters are required only
         if the default parameter values are to be changed.  The default
         value is the last specified value, or if no value has been
         specified, the standard default value as stated here.  This
         implies that the server must "remember" the applicable default
         values.  The commands may be in any order except that they must
         precede the FTP service request.  The following commands
         specify data transfer parameters.

         DATA PORT (PORT)

            The argument is a HOST-PORT specification for the data port
            to be used in data connection.  There defaults for both the
            user and server data ports, and under normal circumstances
            this command and its reply are not needed.  If this command

Top       Page 24 
            is used  the argument is the concatenation of a 32-bit
            internet host address and a 16-bit TCP port address.  This
            address information is broken into 8-bit fields and the
            value of each field is transmitted as a decimal number (in
            character string representation).  The fields are separated
            by commas.  A port command would be:

               PORT h1,h2,h3,h4,p1,p2

            where, h1 is the high order 8 bits of the internet host
            address.

         PASSIVE (PASV)

            This command requests the server-DTP to "listen" on a data
            port (which is not its default data port) and to wait for a
            connection rather than initiate one upon receipt of a
            transfer command.  The response to this command includes the
            host and port address this server is listening on.

         REPRESENTATION TYPE (TYPE)

            The argument specifies the representation type as described
            in the Section on Data Representation and Storage.  Several
            types take a second parameter.  The first parameter is
            denoted by a single TELNET character, as is the second
            Format parameter for ASCII and EBCDIC; the second parameter
            for local byte is a decimal integer to indicate Bytesize.
            The parameters are separated by a <SP> (Space, ASCII code
            32.).

            The following codes are assigned for type:

                         \    /
               A - ASCII |    | N - Non-print
                         |-><-| T - TELNET format effectors
               E - EBCDIC|    | C - Carriage Control (ASA)
                         /    \
               I - Image
               
               L <byte size> - Local byte Byte size

            The default representation type is ASCII Non-print.  If the
            Format parameter is changed, and later just the first
            argument is changed, Format then returns to the Non-print
            default.

Top       Page 25 
         FILE STRUCTURE (STRU)

            The argument is a single TELNET character code specifying
            file structure described in the Section on Data
            Representation and Storage.

            The following codes are assigned for structure:

               F - File (no record structure)
               R - Record structure
               P - Page structure

            The default structure is File.

         TRANSFER MODE (MODE)

            The argument is a single TELNET character code specifying
            the data transfer modes described in the Section on
            Transmission Modes.

            The following codes are assigned for transfer modes:

               S - Stream
               B - Block
               C - Compressed

            The default transfer mode is Stream.

      FTP SERVICE COMMANDS

         The FTP service commands define the file transfer or the file
         system function requested by the user.  The argument of an FTP
         service command will normally be a pathname.  The syntax of
         pathnames must conform to server site conventions (with
         standard defaults applicable), and the language conventions of
         the TELNET connection.  The suggested default handling is to
         use the last specified device, directory or file name, or the
         standard default defined for local users.  The commands may be
         in any order except that a "rename from" command must be
         followed by a "rename to" command and the restart command must
         be followed by the interrupted service command.  The data, when
         transferred in response to FTP service commands, shall always
         be sent over the data connection, except for certain
         informative replies.  The following commands specify FTP
         service requests:

Top       Page 26 
         RETRIEVE (RETR)

            This command causes the server-DTP to transfer a copy of the
            file, specified in the pathname, to the server- or user-DTP
            at the other end of the data connection.  The status and
            contents of the file at the server site shall be unaffected.

         STORE (STOR)

            This command causes the server-DTP to accept the data
            transferred via the data connection and to store the data as
            a file at the server site.  If the file specified in the
            pathname exists at the server site then its contents shall
            be replaced by the data being transferred.  A new file is
            created at the server site if the file specified in the
            pathname does not already exist.

         APPEND (with create) (APPE)

            This command causes the server-DTP to accept the data
            transferred via the data connection and to store the data in
            a file at the server site.  If the file specified in the
            pathname exists at the server site, then the data shall be
            appended to that file; otherwise the file specified in the
            pathname shall be created at the server site.

         MAIL FILE (MLFL)

            The intent of this command is to enable a user at the user
            site to mail data (in form of a file) to another user at the
            server site.  It should be noted that the files to be mailed
            are transmitted via the data connection in ASCII or EBCDIC
            type.  (It is the user's responsibility to ensure that the
            type is correct.)  These files should be inserted into the
            destination user's mailbox by the server in accordance with
            serving Host mail conventions.  The mail may be marked as
            sent from the particular user HOST and the user specified by
            the 'USER' command.  The argument field may contain a Host
            system ident, or it may be empty.  If the argument field is
            empty or blank (one or more spaces), then the mail is
            destined for a printer or other designated place for general
            delivery site mail.

Top       Page 27 
         MAIL (MAIL)

            This command allows a user to send mail that is NOT in a
            file over the TELNET connection.  The argument field may
            contain system ident, or it may be empty.  The ident is
            defined as above for the MLFL command.  After the 'MAIL'
            command is received, the server is to treat the following
            lines as text of the mail sent by the user.  The mail text
            is to be terminated by a line containing only a single
            period, that is, the character sequence "CRLF.CRLF".  It is
            suggested that a modest volume of mail service should be
            free; i.e., it may be entered before a USER command.

         MAIL SEND TO TERMINAL (MSND)

            This command is like the MAIL command, except that the data
            is displayed on the addressed user's terminal, if such
            access is currently allowed, otherwise an error is returned.

         MAIL SEND TO TERMINAL OR MAILBOX (MSOM)

            This command is like the MAIL command, except that the data
            is displayed on the addressed user's terminal, if such
            access is currently allowed, otherwise the data is placed in
            the user's mailbox.

         MAIL SEND TO TERMINAL AND MAILBOX (MSAM)

            This command is like the MAIL command, except that the data
            is displayed on the addressed user's terminal, if such
            access is currently allowed, and, in any case, the data is
            placed in the user's mailbox.

         MAIL RECIPIENT SCHEME QUESTION (MRSQ)

            This FTP command is used to select a scheme for the
            transmission of mail to several users at the same host.  The
            schemes are to list the recipients first, or to send the
            mail first.

         MAIL RECIPIENT (MRCP)

            This command is used to identify the individual recipients
            of the mail in the transmission of mail for multiple users
            at one host.

Top       Page 28 
         ALLOCATE (ALLO)

            This command may be required by some servers to reserve
            sufficient storage to accommodate the new file to be
            transferred.  The argument shall be a decimal integer
            representing the number of bytes (using the logical byte
            size) of storage to be reserved for the file.  For files
            sent with record or page structure a maximum record or page
            size (in logical bytes) might also be necessary; this is
            indicated by a decimal integer in a second argument field of
            the command.  This second argument is optional, but when
            present should be separated from the first by the three
            TELNET characters <SP> R <SP>.  This command shall be
            followed by a STORe or APPEnd command.  The ALLO command
            should be treated as a NOOP (no operation) by those servers
            which do not require that the maximum size of the file be
            declared beforehand, and those servers interested in only
            the maximum record or page size should accept a dummy value
            in the first argument and ignore it.

         RESTART (REST)

            The argument field represents the server marker at which
            file transfer is to be restarted.  This command does not
            cause file transfer but "spaces" over the file to the
            specified data checkpoint.  This command shall be
            immediately followed by the appropriate FTP service command
            which shall cause file transfer to resume.

         RENAME FROM (RNFR)

            This command specifies the file which is to be renamed.
            This command must be immediately followed by a "rename to"
            command specifying the new file pathname.

         RENAME TO (RNTO)

            This command specifies the new pathname of the file
            specified in the immediately preceding "rename from"
            command.  Together the two commands cause a file to be
            renamed.

         ABORT (ABOR)

            This command tells the server to abort the previous FTP
            service command and any associated transfer of data.  The

Top       Page 29 
            abort command may require "special action", as discussed in
            the Section on FTP Commands, to force recognition by the
            server.  No action is to be taken if the previous command
            has been completed (including data transfer).  The TELNET
            connection is not to be closed by the server, but the data
            connection must be closed.

            There are two cases for the server upon receipt of this
            command: (1) the FTP service command was already completed,
            or (2) the FTP service command is still in progress.

               In the first case, the server closes the data connection
               (if it is open) and responds with a 226 reply, indicating
               that the abort command was successfully processed.

               In the second case, the server aborts the FTP service in
               progress and closes the data connection, returning a 426
               reply to indicate that the service request terminated in
               abnormally.  The server then sends a 226 reply,
               indicating that the abort command was successfully
               processed.

         DELETE (DELE)

            This command causes the file specified in the pathname to be
            deleted at the server site.  If an extra level of protection
            is desired (such as the query, "DO you really wish to
            delete?"), it should be provided by the user-FTP process.

         CHANGE WORKING DIRECTORY (CWD)

            This command allows the user to work with a different
            directory or dataset for file storage or retrieval without
            altering his login or accounting information.  Transfer
            parameters are similarly unchanged.  The argument is a
            pathname specifying a directory or other system dependent
            file group designator.

         LIST (LIST)

            This command causes a list to be sent from the server to the
            passive DTP.  If the pathname specifies a directory, the
            server should transfer a list of files in the specified
            directory.  If the pathname specifies a file then the server
            should send current information on the file.  A null
            argument implies the user's current working or default

Top       Page 30 
            directory.  The data transfer is over the data connection in
            type ASCII or type EBCDIC.  (The user must ensure that the
            TYPE is appropriately ASCII or EBCDIC).

         NAME-LIST (NLST)

            This command causes a directory listing to be sent from
            server to user site.  The pathname should specify a
            directory or other system-specific file group descriptor; a
            null argument implies the current directory.  The server
            will return a stream of names of files and no other
            information.  The data will be transferred in ASCII or
            EBCDIC type over the data connection as valid pathname
            strings separated by <CRLF> or <NL>.  (Again the user must
            ensure that the TYPE is correct.)

         SITE PARAMETERS (SITE)

            This command is used by the server to provide services
            specific to his system that are essential to file transfer
            but not sufficiently universal to be included as commands in
            the protocol.  The nature of these services and the
            specification of their syntax can be stated in a reply to
            the HELP SITE command.

         STATUS (STAT)

            This command shall cause a status response to be sent over
            the TELNET connection in the form of a reply.  The command
            may be sent during a file transfer (along with the TELNET IP
            and Synch signals--see the Section on FTP Commands) in which
            case the server will respond with the status of the
            operation in progress, or it may be sent between file
            transfers.  In the latter case the command may have an
            argument field.  If the argument is a pathname, the command
            is analogous to the "list" command except that data shall be
            transferred over the TELNET connection.  If a partial
            pathname is given, the server may respond with a list of
            file names or attributes associated with that specification.
            If no argument is given, the server should return general
            status information about the server FTP process.  This
            should include current values of all transfer parameters and
            the status of connections.

Top       Page 31 
         HELP (HELP)

            This command shall cause the server to send helpful
            information regarding its implementation status over the
            TELNET connection to the user.  The command may take an
            argument (e.g., any command name) and return more specific
            information as a response.  The reply is type 211 or 214.
            It is suggested that HELP be allowed before entering a USER
            command. The server may use this reply to specify
            site-dependent parameters, e.g., in response to HELP SITE.

         NOOP (NOOP)

            This command does not affect any parameters or previously
            entered commands. It specifies no action other than that the
            server send an OK reply.

      The File Transfer Protocol follows the specifications of the
      TELNET protocol for all communications over the TELNET connection.
      Since, the language used for TELNET communication may be a
      negotiated option, all references in the next two sections will be
      to the "TELNET language" and the corresponding "TELNET end of line
      code".  Currently one may take these to mean NVT-ASCII and <CRLF>.
      No other specifications of the TELNET protocol will be cited.

      FTP commands are "TELNET strings" terminated by the "TELNET end of
      line code".  The command codes themselves are alphabetic
      characters terminated by the character <SP> (Space) if parameters
      follow and TELNET-EOL otherwise.  The command codes and the
      semantics of commands are described in this section; the detailed
      syntax of commands is specified in the Section on Commands, the
      reply sequences are discussed in the Section on Sequencing of
      Commands and Replies, and scenarios illustrating the use of
      commands are provided in the Section on Typical FTP Scenarios.

      FTP commands may be partitioned as those specifying access-control
      identifiers, data transfer parameters, or FTP service requests.
      Certain commands (such as ABOR, STAT, QUIT) may be sent over the
      TELNET connection while a data transfer is in progress.  Some
      servers may not be able to monitor the TELNET and data connections
      simultaneously, in which case some special action will be
      necessary to get the server's attention.  The exact form of the
      "special action" is undefined; but the following ordered format is
      tentatively recommended:

Top       Page 32 
         1. User system inserts the TELNET "Interrupt Process" (IP)
            signal in the TELNET stream.

         2. User system sends the TELNET "Synch" signal

         3. User system inserts the command (e.g., ABOR) in the TELNET
            stream.

         4. Server PI,, after receiving "IP", scans the TELNET stream
            for EXACTLY ONE FTP command.

      (For other servers this may not be necessary but the actions
      listed above should have no unusual effect.)

   FTP REPLIES

      Replies to File Transfer Protocol commands are devised to ensure
      the synchronization of requests and actions in the process of file
      transfer, and to guarantee that the user process always knows the
      state of the Server. Every command must generate at least one
      reply, although there may be more than one; in the latter case,
      the multiple replies must be easily distinguished.  In addition,
      some commands occur in sequential groups, such as USER, PASS and
      ACCT, or RNFR and RNTO.  The replies show the existence of an
      intermediate state if all preceding commands have been successful.
      A failure at any point in the sequence necessitates the repetition
      of the entire sequence from the beginning.

         The details of the command-reply sequence are made explicit in
         a set of state diagrams below.

      An FTP reply consists of a three digit number (transmitted as
      three alphanumeric characters) followed by some text.  The number
      is intended for use by automata to determine what state to enter
      next; the text is intended for the human user.  It is intended
      that the three digits contain enough encoded information that the
      user-process (the User-PI) will not need to examine the text and
      may either discard it or pass it on to the user, as appropriate.
      In particular, the text may be server-dependent, so there are
      likely to be varying texts for each reply code.

      Formally, a reply is defined to contain the 3-digit code, followed
      by Space <SP>, followed by one line of text (where some maximum
      line length has been specified), and terminated by the TELNET
      end-of-line code.  There will be cases, however, where the text is
      longer than a single line.  In these cases the complete text must

Top       Page 33 
      be bracketed so the User-process knows when it may stop reading
      the reply (i.e. stop processing input on the TELNET connection)
      and go do other things.  This requires a special format on the
      first line to indicate that more than one line is coming, and
      another on the last line to designate it as the last.  At least
      one of these must contain the appropriate reply code to indicate
      the state of the transaction.  To satisfy all factions it was
      decided that both the first and last line codes should be the
      same.

         Thus the format for multi-line replies is that the first line
         will begin with the exact required reply code, followed
         immediately by a Hyphen, "-" (also known as Minus), followed by
         text.  The last line will begin with the same code, followed
         immediately by Space <SP>, optionally some text, and the TELNET
         end-of-line code.

            For example:
                                123-First line
                                Second line
                                  234 A line beginning with numbers
                                123 The last line

         The user-process then simply needs to search for the second
         occurrence of the same reply code, followed by <SP> (Space), at
         the beginning of a line, and ignore all intermediary lines.  If
         an intermediary line begins with a 3-digit number, the Server
         must pad the front to avoid confusion.

            This scheme allows standard system routines to be used for
            reply information (such as for the STAT reply), with
            "artificial" first and last lines tacked on.  In the rare
            cases where these routines are able to generate three digits
            and a Space at the beginning of any line, the beginning of
            each text line should be offset by some neutral text, like
            Space.

         This scheme assumes that multi-line replies may not be nested.
         We  have found that, in general, nesting of replies will not
         occur, except for random system messages (also called
         spontaneous replies) which may interrupt another reply.  System
         messages (i.e. those not processed by the FTP server) will NOT
         carry reply codes and may occur anywhere in the command-reply
         sequence.  They may be ignored by the User-process as they are
         only information for the human user.

Top       Page 34 
      The three digits of the reply each have a special significance.
      This is intended to allow a range of very simple to very
      sophisticated response by the user-process.  The first digit
      denotes whether the response is good, bad or incomplete.
      (Referring to the state diagram) an unsophisticated user-process
      will be able to determine its next action (proceed as planned,
      redo, retrench, etc.) by simply examining this first digit.  A
      user-process that wants to know approximately what kind of error
      occurred (e.g. file system error, command syntax error) may
      examine the second digit, reserving the third digit for the finest
      gradation of information (e.g. RNTO command without a preceding
      RNFR.)

         There are five values for the first digit of the reply code:

            1yz   Positive Preliminary reply

               The requested action is being initiated; expect another
               reply before proceeding with a new command.  (The
               user-process sending another command before the
               completion reply would be in violation of protocol; but
               server-FTP processes should queue any commands that
               arrive while a preceding command is in progress.)  This
               type of reply can be used to indicate that the command
               was accepted and the user-process may now pay attention
               to the data connections, for implementations where
               simultaneous monitoring is difficult.

            2yz   Positive Completion reply

               The requested action has been successfully completed.  A
               new request may be initiated.

            3yz   Positive Intermediate reply

               The command has been accepted, but the requested action
               is being held in abeyance, pending receipt of further
               information.  The user should send another command
               specifying this information.  This reply is used in
               command sequence groups.

            4yz   Transient Negative Completion reply

               The command was not accepted and the requested action did
               not take place, but the error condition is temporary and
               the action may be requested again.  The user should

Top       Page 35 
               return to the beginning of the command sequence, if any.
               It is difficult to assign a meaning to "transient",
               particularly when two distinct sites (Server and
               User-processes) have to agree on the interpretation.
               Each reply in the 4yz category might have a slightly
               different time value, but the intent is that the
               user-process is encouraged to try again.  A rule of thumb
               in determining if a reply fits into the 4yz or the 5yz
               (Permanent Negative) category is that replies are 4yz if
               the commands can be repeated without any change in
               command form or in properties of the User or Server (e.g.
               the command is spelled the same with the same arguments
               used; the user does not change his file access or user
               name; the server does not put up a new implementation.)

            5yz   Permanent Negative Completion reply

               The command was not accepted and the requested action did
               not take place.  The User-process is discouraged from
               repeating the exact request (in the same sequence).  Even
               some "permanent" error conditions can be corrected, so
               the human user may want to direct his User-process to
               reinitiate the command sequence by direct action at some
               point in the future (e.g. after the spelling has been
               changed, or the user has altered his directory status.)

         The following function groupings are encoded in the second
         digit:

            x0z   Syntax - These replies refer to syntax errors,
                  syntactically correct  commands that don't fit any
                  functional category, unimplemented or superfluous
                  commands.

            x1z   Information -  These are replies to requests for
                  information, such as status or help.

            x2z   Connections - Replies referring to the TELNET and data
                  connections.

            x3z   Authentication and accounting - Replies for the login
                  process and accounting procedures.

            x4z   Unspecified as yet

Top       Page 36 
            x5z   File system - These replies indicate the status of the
                  Server file system vis-a-vis the requested transfer or
                  other file system action.

         The third digit gives a finer gradation of meaning in each of
         the function categories, specified by the second digit.  The
         list of replies below will illustrate this.  Note that the text
         associated with each reply is recommended, rather than
         mandatory, and may even change according to the command with
         which it is associated.  The reply codes, on the other hand,
         must strictly follow the specifications in the last section;
         that is, Server implementations should not invent new codes for
         situations that are only slightly different from the ones
         described here, but rather should adapt codes already defined.

            A command such as TYPE or ALLO whose successful execution
            does not offer the user-process any new information will
            cause a 200 reply to be returned.  If the command is not
            implemented by a particular Server-FTP process because it
            has no relevance to that computer system, for example ALLO
            at a TOPS20 site, a Positive Completion reply is still
            desired so that the simple User-process knows it can proceed
            with its course of action.  A 202 reply is used in this case
            with, for example, the reply text:  "No storage allocation
            necessary."  If, on the other hand, the command requests a
            non-site-specific action and is unimplemented, the response
            is 502.  A refinement of that is the 504 reply for a command
            that IS implemented, but that requests an unimplemented
            parameter.

      Reply Codes by Function Groups

         200 Command okay
         500 Syntax error, command unrecognized
            [This may include errors such as command line too long.]
         501 Syntax error in parameters or arguments
         202 Command not implemented, superfluous at this site.
         502 Command not implemented
         503 Bad sequence of commands
         504 Command not implemented for that parameter
          
         110 Restart marker reply.

Top       Page 37 
            In this case the text is exact and not left to the
            particular implementation; it must read:
                 MARK yyyy = mmmm
            where yyyy is User-process data stream marker, and mmmm
            server's equivalent marker.  (note the spaces between
            markers and "=".)
         119 Terminal not available, will try mailbox.
         211 System status, or system help reply
         212 Directory status
         213 File status
         214 Help message
            (on how to use the server or the meaning of a particular
            non-standard command.  This reply is useful only to the
            human user.)
         215 <scheme> is the preferred scheme.
          
         120 Service ready in nnn minutes
         220 Service ready for new user
         221 Service closing TELNET connection
            (logged out if appropriate)
         421 Service not available, closing TELNET connection.
            This may be a reply to any command if the service knows it
            must shut down.]
         125 Data connection already open; transfer starting
         225 Data connection open; no transfer in progress
         425 Can't open data connection
         226 Closing data connection;
            requested file action successful (for example, file transfer
            or file abort.)
         426 Connection closed; transfer aborted.
         227 Entering Passive Mode.  h1,h2,h3,h4,p1,p2
          
         230 User logged in, proceed
         530 Not logged in
         331 User name okay, need password
         332 Need account for login
         532 Need account for storing files
          
         150 File status okay; about to open data connection.
         151 User not local; Will forward to <user>@<host>.
         152 User Unknown; Mail will be forwarded by the operator.
         250 Requested file action okay, completed.
         350 Requested file action pending further information
         450 Requested file action not taken:
            file unavailable (e.g. file busy)
         550 Requested action not taken:

Top       Page 38 
            file unavailable (e.g. file not found, no access)
         451 Requested action aborted: local error in processing
         551 Requested action aborted: page type unknown
         452 Requested action not taken:
            insufficient storage space in system
         552 Requested file action aborted:
            exceeded storage allocation (for current directory or
            dataset)
         553 Requested action not taken:
            file name not allowed
         354 Start mail input; end with <CR><LF>.<CR><LF>
         

      Numeric Order List of Reply Codes

         110 Restart marker reply.
            In this case the text is exact and not left to the
            particular implementation; it must read:
                 MARK yyyy = mmmm
            where yyyy is User-process data stream marker, and mmmm
            server's equivalent marker.  (note the spaces between
            markers and "=".)
         119 Terminal not available, will try mailbox.
         120 Service ready in nnn minutes
         125 Data connection already open; transfer starting
         150 File status okay; about to open data connection.
         151 User not local; Will forward to <user>@<host>.
         152 User Unknown; Mail will be forwarded by the operator.
         200 Command okay
         202 Command not implemented, superfluous at this site.
         211 System status, or system help reply
         212 Directory status
         213 File status
         214 Help message
            (on how to use the server or the meaning of a particular
            non-standard command.  This reply is useful only to the
            human user.)
         215 <scheme> is the preferred scheme.
         220 Service ready for new user
         221 Service closing TELNET connection
            (logged out if appropriate)
         225 Data connection open; no transfer in progress
         226 Closing data connection;
            requested file action successful (for example, file transfer
            or file abort.)
         227 Entering Passive Mode.  h1,h2,h3,h4,p1,p2

Top       Page 39 
         230 User logged in, proceed
         250 Requested file action okay, completed.
         331 User name okay, need password
         332 Need account for login
         350 Requested file action pending further information
         354 Start mail input; end with <CR><LF>.<CR><LF>
         421 Service not available, closing TELNET connection.
            This may be a reply to any command if the service knows it
            must shut down.]
         425 Can't open data connection
         426 Connection closed; transfer aborted.
         450 Requested file action not taken:
            file unavailable (e.g. file busy)
         451 Requested action aborted: local error in processing
         452 Requested action not taken:
            insufficient storage space in system
         500 Syntax error, command unrecognized
            [This may include errors such as command line too long.]
         501 Syntax error in parameters or arguments
         502 Command not implemented
         503 Bad sequence of commands
         504 Command not implemented for that parameter
         530 Not logged in
         532 Need account for storing files
         550 Requested action not taken:
            file unavailable (e.g. file not found, no access)
         551 Requested action aborted: page type unknown
         552 Requested file action aborted:
            exceeded storage allocation (for current directory or
            dataset)
         553 Requested action not taken:
            file name not allowed
         

Top       Page 40 
DECLARATIVE SPECIFICATIONS

   MINIMUM IMPLEMENTATION

      In order to make FTP workable without needless error messages, the
      following minimum implementation is required for all servers:

         TYPE - ASCII Non-print
         MODE - Stream
         STRUCTURE - File, Record
         COMMANDS - USER, QUIT, PORT,
                    TYPE, MODE, STRU,
                      for the default values
                    RETR, STOR,
                    NOOP.

      The default values for transfer parameters are:

         
         TYPE - ASCII Non-print
         MODE - Stream
         STRU - File

      All Hosts must accept the above as the standard defaults.

   CONNECTIONS

      The server protocol interpreter shall "listen" on Port L.  The
      user or user protocol interpreter shall initiate the full-duplex
      TELNET connection.  Server- and user- processes should follow the
      conventions of the TELNET protocol as specified in the ARPA
      Internet Protocol Handbook.  Servers are under no obligation to
      provide for editing of command lines and may specify that it be
      done in the user Host.  The TELNET connection shall be closed by
      the server at the user's request after all transfers and replies
      are completed.

      The user-DTP must "listen" on the specified data port; this may be
      the default user port (U) or a port specified in the PORT command.
      The server shall initiate the data connection from his own default
      data port (L-1) using the specified user data port.  The direction
      of the transfer and the port used will be determined by the FTP
      service command.

Top       Page 41 
      When data is to be transferred between two servers, A and B (refer
      to Figure 2), the user-PI, C, sets up TELNET connections with both
      server-PI's.  One of the servers, say A, is then sent a PASV
      command telling him to "listen" on his data port rather than
      initiate a connection when he receives a transfer service command.
      When the user-PI receives an acknowledgment to the PASV command,
      which includes the identity of the host and port being listened
      on, the user-PI then sends A's port, a, to B in a PORT command; a
      reply is returned.  The user-PI may then send the corresponding
      service commands to A and B.  Server B initiates the connection
      and the transfer proceeds.  The command-reply sequence is listed
      below where the messages are vertically synchronous but
      horizontally asynchronous:

         User-PI - Server A                User-PI - Server B
         ------------------                ------------------
         
         C->A : Connect                    C->B : Connect
         C->A : PASV
         A->C : 227 Entering Passive Mode. A1,A2,A3,A4,a1,a2
                                           C->B : PORT A1,A2,A3,A4,a1,a2
                                           B->C : 200 Okay
         C->A : STOR                       C->B : RETR
                    B->A : Connect to HOST-A, PORT-a

      The data connection shall be closed by the server under the
      conditions described in the Section on Establishing Data
      Connections.  If the server wishes to close the connection after a
      transfer where it is not required, he should do so immediately
      after the file transfer is completed.  He should not wait until
      after a new transfer command is received because the user-process
      will have already tested the data connection to see if it needs to
      do a "listen"; (recall that the user must "listen" on a closed
      data port BEFORE sending the transfer request).  To prevent a race
      condition here, the server sends a reply (226) after closing the
      data connection (or if the connection is left open, a "file
      transfer completed" reply (250) and the user-PI should wait for
      one of these replies before issuing a new transfer command.

Top       Page 42 
   COMMANDS

      The commands are TELNET character string transmitted over the
      TELNET connections as described in the Section on FTP Commands.
      The command functions and semantics are described in the Section
      on Access Control Commands, Transfer Parameter Commands, FTP
      Service Commands, and Miscellaneous Commands.  The command syntax
      is specified here.

      The commands begin with a command code followed by an argument
      field.  The command codes are four or fewer alphabetic characters.
      Upper and lower case alphabetic characters are to be treated
      identically.  Thus any of the following may represent the retrieve
      command:

         RETR    Retr    retr    ReTr    rETr

      This also applies to any symbols representing parameter values,
      such as A or a for ASCII TYPE.  The command codes and the argument
      fields are separated by one or more spaces.

      The argument field consists of a variable length character string
      ending with the character sequence <CRLF> (Carriage Return,
      Linefeed) for NVT-ASCII representation; for other negotiated
      languages a different end of line character might be used.  It
      should be noted that the server is to take NO action until the end
      of line code is received.

      The syntax is specified below in NVT-ASCII.  All characters in the
      argument field are ASCII characters including any ASCII
      represented decimal integers.  Square brackets denote an optional
      argument field.  If the option is not taken, the appropriate
      default is implied.

Top       Page 43 
      The following are the FTP commands:

         USER <SP> <username> <CRLF>
         PASS <SP> <password> <CRLF>
         ACCT <SP> <account information> <CRLF>
         REIN <CRLF>
         QUIT <CRLF>
         PORT <SP> <Host-port> <CRLF>
         PASV <CRLF>
         TYPE <SP> <type code> <CRLF>
         STRU <SP> <structure code> <CRLF>
         MODE <SP> <mode code> <CRLF>
         RETR <SP> <pathname> <CRLF>
         STOR <SP> <pathname> <CRLF>
         APPE <SP> <pathname> <CRLF>
         MLFL [<SP> <ident>] <CRLF>
         MAIL [<SP> <ident>] <CRLF>
         MSND [<SP> <ident>] <CRLF>
         MSOM [<SP> <ident>] <CRLF>
         MSAM [<SP> <ident>] <CRLF>
         MRSQ [<SP> <scheme>] <CRLF>
         MRCP <SP> <ident> <CRLF>
         ALLO <SP> <decimal integer>
             [<SP> R <SP> <decimal integer>] <CRLF>
         REST <SP> <marker> <CRLF>
         RNFR <SP> <pathname> <CRLF>
         RNTO <SP> <pathname> <CRLF>
         ABOR <CRLF>
         DELE <SP> <pathname> <CRLF>
         CWD <SP> <pathname> <CRLF>
         LIST [<SP> <pathname>] <CRLF>
         NLST [<SP> <pathname>] <CRLF>
         SITE <SP> <string> <CRLF>
         STAT [<SP> <pathname>] <CRLF>
         HELP [<SP> <string>] <CRLF>
         NOOP <CRLF>


Next RFC Part