7 Network Working Group P. Hethmon
8 Request for Comments: 3659 Hethmon Software
9 Updates: 959 March 2007
10 Category: Standards Track
17 This document specifies an Internet standards track protocol for the
18 Internet community, and requests discussion and suggestions for
19 improvements. Please refer to the current edition of the "Internet
20 Official Protocol Standards" (STD 1) for the standardization state
21 and status of this protocol. Distribution of this memo is unlimited.
25 Copyright (C) The IETF Trust (2007).
29 This document specifies new FTP commands to obtain listings of remote
30 directories in a defined format, and to permit restarts of
31 interrupted data transfers in STREAM mode. It allows character sets
32 other than US-ASCII, and also defines an optional virtual file
58 Hethmon Standards Track [Page 1]
60 RFC 3659 Extensions to FTP March 2007
65 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
66 2. Document Conventions . . . . . . . . . . . . . . . . . . . . . 3
67 2.1. Basic Tokens . . . . . . . . . . . . . . . . . . . . . . 4
68 2.2. Pathnames. . . . . . . . . . . . . . . . . . . . . . . . 4
69 2.3. Times. . . . . . . . . . . . . . . . . . . . . . . . . . 6
70 2.4. Server Replies . . . . . . . . . . . . . . . . . . . . . 7
71 2.5. Interpreting Examples. . . . . . . . . . . . . . . . . . 8
72 3. File Modification Time (MDTM). . . . . . . . . . . . . . . . . 8
73 3.1. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 9
74 3.2. Error Responses. . . . . . . . . . . . . . . . . . . . . 9
75 3.3. FEAT Response for MDTM . . . . . . . . . . . . . . . . . 10
76 3.4. MDTM Examples. . . . . . . . . . . . . . . . . . . . . . 10
77 4. File SIZE. . . . . . . . . . . . . . . . . . . . . . . . . . . 11
78 4.1. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 11
79 4.2. Error Responses. . . . . . . . . . . . . . . . . . . . . 12
80 4.3. FEAT Response for SIZE . . . . . . . . . . . . . . . . . 12
81 4.4. Size Examples. . . . . . . . . . . . . . . . . . . . . . 12
82 5. Restart of Interrupted Transfer (REST) . . . . . . . . . . . . 13
83 5.1. Restarting in STREAM Mode. . . . . . . . . . . . . . . . 14
84 5.2. Error Recovery and Restart . . . . . . . . . . . . . . . 14
85 5.3. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 15
86 5.4. FEAT Response for REST . . . . . . . . . . . . . . . . . 16
87 5.5. REST Example . . . . . . . . . . . . . . . . . . . . . . 17
88 6. A Trivial Virtual File Store (TVFS). . . . . . . . . . . . . . 17
89 6.1. TVFS File Names. . . . . . . . . . . . . . . . . . . . . 18
90 6.2. TVFS Pathnames . . . . . . . . . . . . . . . . . . . . . 18
91 6.3. FEAT Response for TVFS . . . . . . . . . . . . . . . . . 20
92 6.4. OPTS for TVFS. . . . . . . . . . . . . . . . . . . . . . 21
93 6.5. TVFS Examples. . . . . . . . . . . . . . . . . . . . . . 21
94 7. Listings for Machine Processing (MLST and MLSD). . . . . . . . 23
95 7.1. Format of MLSx Requests. . . . . . . . . . . . . . . . . 23
96 7.2. Format of MLSx Response. . . . . . . . . . . . . . . . . 24
97 7.3. File Name Encoding . . . . . . . . . . . . . . . . . . . 26
98 7.4. Format of Facts. . . . . . . . . . . . . . . . . . . . . 28
99 7.5. Standard Facts . . . . . . . . . . . . . . . . . . . . . 28
100 7.6. System Dependent and Local Facts . . . . . . . . . . . . 36
101 7.7. MLSx Examples. . . . . . . . . . . . . . . . . . . . . . 37
102 7.8. FEAT Response for MLSx . . . . . . . . . . . . . . . . . 49
103 7.9. OPTS Parameters for MLST . . . . . . . . . . . . . . . . 51
104 8. Impact on Other FTP Commands . . . . . . . . . . . . . . . . . 54
105 9. Character Sets and Internationalization. . . . . . . . . . . . 55
106 10. IANA Considerations. . . . . . . . . . . . . . . . . . . . . . 55
107 10.1. The OS Specific Fact Registry. . . . . . . . . . . . . . 56
108 10.2. The OS Specific Filetype Registry. . . . . . . . . . . . 56
114 Hethmon Standards Track [Page 2]
116 RFC 3659 Extensions to FTP March 2007
119 11. Security Considerations. . . . . . . . . . . . . . . . . . . . 57
120 12. Normative References . . . . . . . . . . . . . . . . . . . . . 58
121 Acknowledgments. . . . . . . . . . . . . . . . . . . . . . . . . . 59
125 This document updates the File Transfer Protocol (FTP) [3]. Four new
126 commands are added: "SIZE", "MDTM", "MLST", and "MLSD". The existing
127 command "REST" is modified. Of those, the "SIZE" and "MDTM"
128 commands, and the modifications to "REST" have been in wide use for
129 many years. The others are new.
131 These commands allow a client to restart an interrupted transfer in
132 transfer modes not previously supported in any documented way, and to
133 obtain a directory listing in a machine friendly, predictable,
136 An optional structure for the server's file store (NVFS) is also
137 defined, allowing servers that support such a structure to convey
138 that information to clients in a standard way, thus allowing clients
139 more certainty in constructing and interpreting pathnames.
141 2. Document Conventions
143 This document makes use of the document conventions defined in BCP
144 14, RFC 2119 [4]. That provides the interpretation of capitalized
145 imperative words like MUST, SHOULD, etc.
147 This document also uses notation defined in STD 9, RFC 959 [3]. In
148 particular, the terms "reply", "user", "NVFS" (Network Virtual File
149 System), "file", "pathname", "FTP commands", "DTP" (data transfer
150 process), "user-FTP process", "user-PI" (user protocol interpreter),
151 "user-DTP", "server-FTP process", "server-PI", "server-DTP", "mode",
152 "type", "NVT" (Network Virtual Terminal), "control connection", "data
153 connection", and "ASCII", are all used here as defined there.
155 Syntax required is defined using the Augmented BNF defined in [5].
156 Some general ABNF definitions that are required throughout the
157 document will be defined later in this section. At first reading, it
158 may be wise to simply recall that these definitions exist here, and
159 skip to the next section.
170 Hethmon Standards Track [Page 3]
172 RFC 3659 Extensions to FTP March 2007
177 This document imports the core ABNF definitions given in Appendix A
178 of [5]. There definitions will be found for basic ABNF elements like
179 ALPHA, DIGIT, SP, etc. The following terms are added for use in this
182 TCHAR = VCHAR / SP / HTAB ; visible plus white space
183 RCHAR = ALPHA / DIGIT / "," / "." / ":" / "!" /
184 "@" / "#" / "$" / "%" / "^" /
185 "&" / "(" / ")" / "-" / "_" /
186 "+" / "?" / "/" / "\" / "'" /
187 DQUOTE ; <"> -- double quote character (%x22)
188 SCHAR = RCHAR / "=" ;
190 The VCHAR (from [5]), RCHAR, SCHAR, and TCHAR types give basic
191 character types from varying sub-sets of the ASCII character set for
192 use in various commands and responses.
196 A "token" is a string whose precise meaning depends upon the context
197 in which it is used. In some cases it will be a value from a set of
198 possible values maintained elsewhere. In others it might be a string
199 invented by one party to an FTP conversation from whatever sources it
202 Note that in ABNF, string literals are case insensitive. That
203 convention is preserved in this document, and implies that FTP
204 commands added by this specification have names that can be
205 represented in any case. That is, "MDTM" is the same as "mdtm",
206 "Mdtm" and "MdTm" etc. However note that ALPHA, in particular, is
207 case sensitive. That implies that a "token" is a case sensitive
208 value. That implication is correct, except where explicitly stated
209 to the contrary in this document, or in some other specification that
210 defines the values this document specifies be used in a particular
215 Various FTP commands take pathnames as arguments, or return pathnames
216 in responses. When the MLST command is supported, as indicated in
217 the response to the FEAT command [6], pathnames are to be transferred
218 in one of the following two formats.
226 Hethmon Standards Track [Page 4]
228 RFC 3659 Extensions to FTP March 2007
231 pathname = utf-8-name / raw
232 utf-8-name = <a UTF-8 encoded Unicode string>
233 raw = <any string that is not a valid UTF-8 encoding>
235 Which format is used is at the option of the user-PI or server-PI
236 sending the pathname. UTF-8 encodings [2] contain enough internal
237 structure that it is always, in practice, possible to determine
238 whether a UTF-8 or raw encoding has been used, in those cases where
239 it matters. While it is useful for the user-PI to be able to
240 correctly display a pathname received from the server-PI to the user,
241 it is far more important for the user-PI to be able to retain and
242 retransmit the identical pathname when required. Implementations are
243 advised against converting a UTF-8 pathname to a local charset that
244 isn't capable of representing the full Unicode character repertoire,
245 and then attempting to invert the charset translation later. Note
246 that ASCII is a subset of UTF-8. See also [1].
248 Unless otherwise specified, the pathname is terminated by the CRLF
249 that terminates the FTP command, or by the CRLF that ends a reply.
250 Any trailing spaces preceding that CRLF form part of the name.
251 Exactly one space will precede the pathname and serve as a separator
252 from the preceding syntax element. Any additional spaces form part
253 of the pathname. See [7] for a fuller explanation of the character
254 encoding issues. All implementations supporting MLST MUST support
257 Note: for pathnames transferred over a data connection, there is no
258 way to represent a pathname containing the characters CR and LF in
259 sequence, and distinguish that from the end of line indication.
260 Hence, pathnames containing the CRLF pair of characters cannot be
261 transmitted over a data connection. Data connections only contain
262 file names transmitted from server-FTP to user-FTP as the result of
263 one of the directory listing commands. Files with names containing
264 the CRLF sequence must either have that sequence converted to some
265 other form, such that the other form can be recognised and be
266 correctly converted back to CRLF, or be omitted from the listing.
268 Implementations should also beware that the FTP control connection
269 uses Telnet NVT conventions [8], and that the Telnet IAC character,
270 if part of a pathname sent over the control connection, MUST be
271 correctly escaped as defined by the Telnet protocol.
273 NVT also distinguishes between CR, LF, and the end of line CRLF, and
274 so would permit pathnames containing the pair of characters CR and LF
275 to be correctly transmitted. However, because such a sequence cannot
276 be transmitted over a data connection (as part of the result of a
277 LIST, NLST, or MLSD command), such pathnames are best avoided.
282 Hethmon Standards Track [Page 5]
284 RFC 3659 Extensions to FTP March 2007
287 Implementors should also be aware that, although Telnet NVT
288 conventions are used over the control connections, Telnet option
289 negotiation MUST NOT be attempted. See section 4.1.2.12 of [9].
291 2.2.1. Pathname Syntax
293 Except where TVFS is supported (see section 6), this specification
294 imposes no syntax upon pathnames. Nor does it restrict the character
295 set from which pathnames are created. This does not imply that the
296 NVFS is required to make sense of all possible pathnames. Server-PIs
297 may restrict the syntax of valid pathnames in their NVFS in any
298 manner appropriate to their implementation or underlying file system.
299 Similarly, a server-PI may parse the pathname and assign meaning to
300 the components detected.
304 For the commands defined in this specification, all pathnames are to
305 be treated literally. That is, for a pathname given as a parameter
306 to a command, the file whose name is identical to the pathname given
307 is implied. No characters from the pathname may be treated as
308 special or "magic", thus no pattern matching (other than for exact
309 equality) between the pathname given and the files present in the
310 NVFS of the server-FTP is permitted.
312 Clients that desire some form of pattern matching functionality must
313 obtain a listing of the relevant directory, or directories, and
314 implement their own file name selection procedures.
318 The syntax of a time value is:
320 time-val = 14DIGIT [ "." 1*DIGIT ]
322 The leading, mandatory, fourteen digits are to be interpreted as, in
323 order from the leftmost, four digits giving the year, with a range of
324 1000--9999, two digits giving the month of the year, with a range of
325 01--12, two digits giving the day of the month, with a range of
326 01--31, two digits giving the hour of the day, with a range of
327 00--23, two digits giving minutes past the hour, with a range of
328 00--59, and finally, two digits giving seconds past the minute, with
329 a range of 00--60 (with 60 being used only at a leap second). Years
330 in the tenth century, and earlier, cannot be expressed. This is not
331 considered a serious defect of the protocol.
338 Hethmon Standards Track [Page 6]
340 RFC 3659 Extensions to FTP March 2007
343 The optional digits, which are preceded by a period, give decimal
344 fractions of a second. These may be given to whatever precision is
345 appropriate to the circumstance, however implementations MUST NOT add
346 precision to time-vals where that precision does not exist in the
347 underlying value being transmitted.
349 Symbolically, a time-val may be viewed as
353 The "." and subsequent digits ("sss") are optional. However the "."
354 MUST NOT appear unless at least one following digit also appears.
356 Time values are always represented in UTC (GMT), and in the Gregorian
357 calendar regardless of what calendar may have been in use at the date
358 and time indicated at the location of the server-PI.
360 The technical differences among GMT, TAI, UTC, UT1, UT2, etc., are
361 not considered here. A server-FTP process should always use the same
362 time reference, so the times it returns will be consistent. Clients
363 are not expected to be time synchronized with the server, so the
364 possible difference in times that might be reported by the different
365 time standards is not considered important.
369 Section 4.2 of [3] defines the format and meaning of replies by the
370 server-PI to FTP commands from the user-PI. Those reply conventions
371 are used here without change.
373 error-response = error-code SP *TCHAR CRLF
374 error-code = ("4" / "5") 2DIGIT
376 Implementors should note that the ABNF syntax used in this document
377 and in other FTP related documents (but not used in [3]), sometimes
378 shows replies using the one-line format. Unless otherwise explicitly
379 stated, that is not intended to imply that multi-line responses are
380 not permitted. Implementors should assume that, unless stated to the
381 contrary, any reply to any FTP command (including QUIT) may use the
382 multi-line format described in [3].
384 Throughout this document, replies will be identified by the three
385 digit code that is their first element. Thus the term "500 reply"
386 means a reply from the server-PI using the three digit code "500".
394 Hethmon Standards Track [Page 7]
396 RFC 3659 Extensions to FTP March 2007
399 2.5. Interpreting Examples
401 In the examples of FTP dialogs presented in this document, lines that
402 begin "C> " were sent over the control connection from the user-PI to
403 the server-PI, lines that begin "S> " were sent over the control
404 connection from the server-PI to the user-PI, and each sequence of
405 lines that begin "D> " was sent from the server-PI to the user-PI
406 over a data connection created just to send those lines and closed
407 immediately after. No examples here show data transferred over a
408 data connection from the client to the server. In all cases, the
409 prefixes shown above, including the one space, have been added for
410 the purposes of this document, and are not a part of the data
411 exchanged between client and server.
413 3. File Modification Time (MDTM)
415 The FTP command, MODIFICATION TIME (MDTM), can be used to determine
416 when a file in the server NVFS was last modified. This command has
417 existed in many FTP servers for many years, as an adjunct to the REST
418 command for STREAM mode, thus is widely available. However, where
419 supported, the "modify" fact that can be provided in the result from
420 the new MLST command is recommended as a superior alternative.
422 When attempting to restart a RETRieve, the user-FTP can use the MDTM
423 command or the "modify" fact to check if the modification time of the
424 source file is more recent than the modification time of the
425 partially transferred file. If it is, then most likely the source
426 file has changed, and it would be unsafe to restart the previously
427 incomplete file transfer.
429 Because the user- and server-FTPs' clocks are not necessarily
430 synchronised, user-FTPs intending to use this method should usually
431 obtain the modification time of the file from the server before the
432 initial RETRieval, and compare that with the modification time before
433 a RESTart. If they differ, the files may have changed, and RESTart
434 would be inadvisable. Where this is not possible, the user-FTP
435 should make sure to allow for possible clock skew when comparing
438 When attempting to restart a STORe, the User FTP can use the MDTM
439 command to discover the modification time of the partially
440 transferred file. If it is older than the modification time of the
441 file that is about to be STORed, then most likely the source file has
442 changed, and it would be unsafe to restart the file transfer.
450 Hethmon Standards Track [Page 8]
452 RFC 3659 Extensions to FTP March 2007
455 Note that using MLST (described below), where available, can provide
456 this information and much more, thus giving an even better indication
457 that a file has changed and that restarting a transfer would not give
460 Note that this is applicable to any RESTart attempt, regardless of
461 the mode of the file transfer.
465 The syntax for the MDTM command is:
467 mdtm = "MdTm" SP pathname CRLF
469 As with all FTP commands, the "MDTM" command label is interpreted in
470 a case-insensitive manner.
472 The "pathname" specifies an object in the NVFS that may be the object
473 of a RETR command. Attempts to query the modification time of files
474 that exist but are unable to be retrieved may generate an error-
475 response, or can result in a positive response carrying a time-val
476 with an unspecified value, the choice being made by the server-PI.
478 The server-PI will respond to the MDTM command with a 213 reply
479 giving the last modification time of the file whose pathname was
480 supplied, or a 550 reply if the file does not exist, the modification
481 time is unavailable, or some other error has occurred.
483 mdtm-response = "213" SP time-val CRLF /
486 Note that when the 213 response is issued, that is, when there is no
487 error, the format MUST be exactly as specified. Multi-line responses
492 Where the command is correctly parsed but the modification time is
493 not available, either because the pathname identifies no existing
494 entity or because the information is not available for the entity
495 named, then a 550 reply should be sent. Where the command cannot be
496 correctly parsed, a 500 or 501 reply should be sent, as specified in
497 [3]. Various 4xy replies are also possible in appropriate
506 Hethmon Standards Track [Page 9]
508 RFC 3659 Extensions to FTP March 2007
511 3.3. FEAT Response for MDTM
513 When replying to the FEAT command [6], a server-FTP process that
514 supports the MDTM command MUST include a line containing the single
515 word "MDTM". This MAY be sent in upper or lower case or a mixture of
516 both (it is case insensitive), but SHOULD be transmitted in upper
517 case only. That is, the response SHOULD be:
520 S> 211- <any descriptive text>
526 The ellipses indicate place holders where other features may be
527 included, but are not required. The one-space indentation of the
528 feature lines is mandatory [6].
532 If we assume the existence of three files, A B and C, a directory D,
533 two files with names that end with the string "ile6", and no other
534 files at all, then the MDTM command may behave as indicated. The
535 "C>" lines are commands from user-PI to server-PI, the "S>" lines are
539 S> 213 19980615100045.014
541 S> 213 19980615100045.014
543 S> 213 19980705132316
545 S> 550 D is not retrievable
547 S> 550 No file named "E"
549 S> 213 19990929003355
550 C> MdTm 19990929043300 File6
551 S> 213 19991005213102
552 C> MdTm 19990929043300 file6
553 S> 550 19990929043300 file6: No such file or directory.
555 From that we can conclude that both A and B were last modified at the
556 same time (to the nearest millisecond), and that C was modified 20
557 days and several hours later.
562 Hethmon Standards Track [Page 10]
564 RFC 3659 Extensions to FTP March 2007
567 The times are in GMT, so file A was modified on the 15th of June,
568 1998, at approximately 11am in London (summer time was then in
569 effect), or perhaps at 8pm in Melbourne, Australia, or at 6am in New
570 York. All of those represent the same absolute time, of course. The
571 location where the file was modified, and consequently the local wall
572 clock time at that location, is not available.
574 There is no file named "E" in the current directory, but there are
575 files named both "file6" and "19990929043300 File6". The
576 modification times of those files were obtained. There is no file
577 named "19990929043300 file6".
581 The FTP command, SIZE OF FILE (SIZE), is used to obtain the transfer
582 size of a file from the server-FTP process. This is the exact number
583 of octets (8 bit bytes) that would be transmitted over the data
584 connection should that file be transmitted. This value will change
585 depending on the current STRUcture, MODE, and TYPE of the data
586 connection or of a data connection that would be created were one
587 created now. Thus, the result of the SIZE command is dependent on
588 the currently established STRU, MODE, and TYPE parameters.
590 The SIZE command returns how many octets would be transferred if the
591 file were to be transferred using the current transfer structure,
592 mode, and type. This command is normally used in conjunction with
593 the RESTART (REST) command when STORing a file to a remote server in
594 STREAM mode, to determine the restart point. The server-PI might
595 need to read the partially transferred file, do any appropriate
596 conversion, and count the number of octets that would be generated
597 when sending the file in order to correctly respond to this command.
598 Estimates of the file transfer size MUST NOT be returned; only
599 precise information is acceptable.
603 The syntax of the SIZE command is:
605 size = "Size" SP pathname CRLF
607 The server-PI will respond to the SIZE command with a 213 reply
608 giving the transfer size of the file whose pathname was supplied, or
609 an error response if the file does not exist, the size is
610 unavailable, or some other error has occurred. The value returned is
611 in a format suitable for use with the RESTART (REST) command for mode
612 STREAM, provided the transfer mode and type are not altered.
618 Hethmon Standards Track [Page 11]
620 RFC 3659 Extensions to FTP March 2007
623 size-response = "213" SP 1*DIGIT CRLF /
626 Note that when the 213 response is issued, that is, when there is no
627 error, the format MUST be exactly as specified. Multi-line responses
632 Where the command is correctly parsed but the size is not available,
633 perhaps because the pathname identifies no existing entity or because
634 the entity named cannot be transferred in the current MODE and TYPE
635 (or at all), then a 550 reply should be sent. Where the command
636 cannot be correctly parsed, a 500 or 501 reply should be sent, as
637 specified in [3]. The presence of the 550 error response to a SIZE
638 command MUST NOT be taken by the client as an indication that the
639 file cannot be transferred in the current MODE and TYPE. A server
640 may generate this error for other reasons -- for instance if the
641 processing overhead is considered too great. Various 4xy replies are
642 also possible in appropriate circumstances.
644 4.3. FEAT Response for SIZE
646 When replying to the FEAT command [6], a server-FTP process that
647 supports the SIZE command MUST include a line containing the single
648 word "SIZE". This word is case insensitive, and MAY be sent in any
649 mixture of upper or lower case, however it SHOULD be sent in upper
650 case. That is, the response SHOULD be:
653 S> 211- <any descriptive text>
659 The ellipses indicate place holders where other features may be
660 included, and are not required. The one-space indentation of the
661 feature lines is mandatory [6].
665 Consider a text file "Example" stored on a Unix(TM) server where each
666 end of line is represented by a single octet. Assume the file
667 contains 112 lines, and 1830 octets total. Then the SIZE command
674 Hethmon Standards Track [Page 12]
676 RFC 3659 Extensions to FTP March 2007
680 S> 200 Type set to I.
684 S> 200 Type set to A.
688 Notice that with TYPE=A the SIZE command reports an extra 112 octets.
689 Those are the extra octets that need to be inserted, one at the end
690 of each line, to provide correct end-of-line semantics for a transfer
691 using TYPE=A. Other systems might need to make other changes to the
692 transfer format of files when converting between TYPEs and MODEs.
693 The SIZE command takes all of that into account.
695 Since calculating the size of a file with this degree of precision
696 may take considerable effort on the part of the server-PI, user-PIs
697 should not used this command unless this precision is essential (such
698 as when about to restart an interrupted transfer). For other uses,
699 the "Size" fact of the MLST command (see section 7.5.7) ought be
702 5. Restart of Interrupted Transfer (REST)
704 To avoid having to resend the entire file if the file is only
705 partially transferred, both sides need some way to agree on where in
706 the data stream to restart the data transfer.
708 The FTP specification [3] includes three modes of data transfer,
709 STREAM, Block, and Compressed. In Block and Compressed modes, the
710 data stream that is transferred over the data connection is
711 formatted, allowing the embedding of restart markers into the stream.
712 The sending DTP can include a restart marker with whatever
713 information it needs to be able to restart a file transfer at that
714 point. The receiving DTP can keep a list of these restart markers,
715 and correlate them with how the file is being saved. To restart the
716 file transfer, the receiver just sends back that last restart marker,
717 and both sides know how to resume the data transfer. Note that there
718 are some flaws in the description of the restart mechanism in STD 9,
719 RFC 959 [3]. See section 4.1.3.4 of RFC 1123 [9] for the
730 Hethmon Standards Track [Page 13]
732 RFC 3659 Extensions to FTP March 2007
735 5.1. Restarting in STREAM Mode
737 In STREAM mode, the data connection contains just a stream of
738 unformatted octets of data. Explicit restart markers thus cannot be
739 inserted into the data stream, they would be indistinguishable from
740 data. For this reason, the FTP specification [3] did not provide the
741 ability to do restarts in stream mode. However, there is not really
742 a need to have explicit restart markers in this case, as restart
743 markers can be implied by the octet offset into the data stream.
745 Because the data stream defines the file in STREAM mode, a different
746 data stream would represent a different file. Thus, an offset will
747 always represent the same position within a file. On the other hand,
748 in other modes than STREAM, the same file can be transferred using
749 quite different octet sequences and yet be reconstructed into the one
750 identical file. Thus an offset into the data stream in transfer
751 modes other than STREAM would not give an unambiguous restart point.
753 If the data representation TYPE is IMAGE and the STRUcture is File,
754 for many systems the file will be stored exactly in the same format
755 as it is sent across the data connection. It is then usually very
756 easy for the receiver to determine how much data was previously
757 received, and notify the sender of the offset where the transfer
758 should be restarted. In other representation types and structures
759 more effort will be required, but it remains always possible to
760 determine the offset with finite, but perhaps non-negligible, effort.
761 In the worst case, an FTP process may need to open a data connection
762 to itself, set the appropriate transfer type and structure, and
763 actually transmit the file, counting the transmitted octets.
765 If the user-FTP process is intending to restart a retrieve, it will
766 directly calculate the restart marker and send that information in
767 the RESTart command. However, if the user-FTP process is intending
768 to restart sending the file, it needs to be able to determine how
769 much data was previously sent, and correctly received and saved. A
770 new FTP command is needed to get this information. This is the
771 purpose of the SIZE command, as documented in section 4.
773 5.2. Error Recovery and Restart
775 STREAM mode transfers with FILE STRUcture may be restarted even
776 though no restart marker has been transferred in addition to the data
777 itself. This is done by using the SIZE command, if needed, in
778 combination with the RESTART (REST) command, and one of the standard
779 file transfer commands.
781 When using TYPE ASCII or IMAGE, the SIZE command will return the
782 number of octets that would actually be transferred if the file were
786 Hethmon Standards Track [Page 14]
788 RFC 3659 Extensions to FTP March 2007
791 to be sent between the two systems, i.e., with type IMAGE, the SIZE
792 normally would be the number of octets in the file. With type ASCII,
793 the SIZE would be the number of octets in the file including any
794 modifications required to satisfy the TYPE ASCII CR-LF end-of-line
799 The syntax for the REST command when the current transfer mode is
802 rest = "Rest" SP 1*DIGIT CRLF
804 The numeric value gives the number of octets of the immediately-
805 following transfer to not actually send, effectively causing the
806 transmission to be restarted at a later point. A value of zero
807 effectively disables restart, causing the entire file to be
808 transmitted. The server-PI will respond to the REST command with a
809 350 reply, indicating that the REST parameter has been saved, and
810 that another command, which should be either RETR or STOR, should
811 then follow to complete the restart.
813 rest-response = "350" SP *TCHAR CRLF /
816 Server-FTP processes may permit transfer commands other than RETR and
817 STOR, such as APPE and STOU, to complete a restart; however, this is
818 not recommended. STOU (store unique) is undefined in this usage, as
819 storing the remainder of a file into a unique file name is rarely
820 going to be useful. If APPE (append) is permitted, it MUST act
821 identically to STOR when a restart marker has been set. That is, in
822 both cases, octets from the data connection are placed into the file
823 at the location indicated by the restart marker value.
825 The REST command is intended to complete a failed transfer. Use with
826 RETR is comparatively well defined in all cases, as the client bears
827 the responsibility of merging the retrieved data with the partially
828 retrieved file. It may choose to use the data obtained other than to
829 complete an earlier transfer, or to re-retrieve data that had been
830 retrieved before. With STOR, however, the server must insert the
831 data into the file named. The results are undefined if a client uses
832 REST to do other than restart to complete a transfer of a file that
833 had previously failed to completely transfer. In particular, if the
834 restart marker set with a REST command is not at the end of the data
835 currently stored at the server, as reported by the server, or if
836 insufficient data are provided in a STOR that follows a REST to
837 extend the destination file to at least its previous size, then the
838 effects are undefined.
842 Hethmon Standards Track [Page 15]
844 RFC 3659 Extensions to FTP March 2007
847 The REST command must be the last command issued before the data
848 transfer command that is to cause a restarted, rather than a
849 complete, file transfer. The effect of issuing a REST command at any
850 other time is undefined. The server-PI may react to a badly
851 positioned REST command by issuing an error response to the following
852 command, not being a restartable data transfer command, or it may
853 save the restart value and apply it to the next data transfer
854 command, or it may silently ignore the inappropriate restart attempt.
855 Because of this, a user-PI that has issued a REST command, but that
856 has not successfully transmitted the following data transfer command
857 for any reason, should send another REST command before the next data
858 transfer command. If that transfer is not to be restarted, then
859 "REST 0" should be issued.
861 An error response will follow a REST command only when the server
862 does not implement the command, or when the restart marker value is
863 syntactically invalid for the current transfer mode (e.g., in STREAM
864 mode, something other than one or more digits appears in the
865 parameter to the REST command). Any other errors, including such
866 problems as restart marker out of range, should be reported when the
867 following transfer command is issued. Such errors will cause that
868 transfer request to be rejected with an error indicating the invalid
871 5.4. FEAT Response for REST
873 Where a server-FTP process supports RESTart in STREAM mode, as
874 specified here, it MUST include, in the response to the FEAT command
875 [6], a line containing exactly the string "REST STREAM". This string
876 is not case sensitive, but it SHOULD be transmitted in upper case.
877 Where REST is not supported at all or supported only in block or
878 compressed modes, the REST line MUST NOT be included in the FEAT
879 response. Where required, the response SHOULD be:
882 S> 211- <any descriptive text>
888 The ellipses indicate place holders where other features may be
889 included, and are not required. The one-space indentation of the
890 feature lines is mandatory [6].
898 Hethmon Standards Track [Page 16]
900 RFC 3659 Extensions to FTP March 2007
905 Assume that the transfer of a largish file has previously been
906 interrupted after 802816 octets had been received, that the previous
907 transfer was with TYPE=I, and that it has been verified that the file
908 on the server has not since changed.
911 S> 200 Type set to I.
912 C> PORT 127,0,0,1,15,107
913 S> 200 PORT command successful.
915 S> 350 Restarting at 802816. Send STORE or RETRIEVE
916 C> RETR cap60.pl198.tar
917 S> 150 Opening BINARY mode data connection
919 S> 226 Transfer complete.
921 6. A Trivial Virtual File Store (TVFS)
923 Traditionally, FTP has placed almost no constraints upon the file
924 store (NVFS) provided by a server. This specification does not alter
925 that. However, it has become common for servers to attempt to
926 provide at least file system naming conventions modeled loosely upon
927 those of the UNIX(TM) file system. This is a tree-structured file
928 system, built of directories, each of which can contain other
929 directories, or other kinds of files, or both. Each file and
930 directory has a name relative to the directory that contains it,
931 except for the directory at the root of the tree, which is contained
932 in no other directory, and hence has no name of its own.
934 That which has so far been described is perfectly consistent with the
935 standard FTP NVFS and access mechanisms. The "CWD" command is used
936 to move from one directory to an embedded directory. "CDUP" may be
937 provided to return to the parent directory, and the various file
938 manipulation commands ("RETR", "STOR", the rename commands, etc.) are
939 used to manipulate files within the current directory.
941 However, it is often useful to be able to reference files other than
942 by changing directories, especially as FTP provides no guaranteed
943 mechanism to return to a previous directory. The Trivial Virtual
944 File Store (TVFS), if implemented, provides that mechanism.
954 Hethmon Standards Track [Page 17]
956 RFC 3659 Extensions to FTP March 2007
961 Where a server implements the TVFS, no elementary file name shall
962 contain the character "/". Where the underlying natural file store
963 permits files, or directories, to contain the "/" character in their
964 names, a server-PI implementing TVFS must encode that character in
965 some manner whenever file or directory names are being returned to
966 the user-PI, and reverse that encoding whenever such names are being
967 accepted from the user-PI.
969 The encoding method to be used is not specified here. Where some
970 other character is illegal in file and directory names in the
971 underlying file store, a simple transliteration may be sufficient.
972 Where there is no suitable substitute character a more complex
973 encoding scheme, possibly using an escape character, is likely to be
976 With the one exception of the unnamed root directory, a TVFS file
977 name may not be empty. That is, all other file names contain at
980 With the sole exception of the "/" character, any valid IS10646
981 character [10] may be used in a TVFS file name. When transmitted,
982 file name characters are encoded using the UTF-8 encoding [2]. Note
983 that the two-character sequence CR LF occurring in a file name will
984 make that name impossible to transmit over a data connection.
985 Consequently, it should be avoided, or if that is impossible to
986 achieve, it MUST be encoded in some reversible way.
990 A TVFS "Pathname" combines the file or directory name of a target
991 file or directory, with the directory names of zero or more enclosing
992 directories, so as to allow the target file or directory to be
993 referenced other than when the server's "current working directory"
994 is the directory directly containing the target file or directory.
996 By definition, every TVFS file or directory name is also a TVFS
997 pathname. Such a pathname is valid to reference the file from the
998 directory containing the name, that is, when that directory is the
999 server-FTP's current working directory.
1001 Other TVFS pathnames are constructed by prefixing a pathname by a
1002 name of a directory from which the path is valid, and separating the
1003 two with the "/" character. Such a pathname is valid to reference
1004 the file or directory from the directory containing the newly added
1010 Hethmon Standards Track [Page 18]
1012 RFC 3659 Extensions to FTP March 2007
1015 Where a pathname has been extended to the point where the directory
1016 added is the unnamed root directory, the pathname will begin with the
1017 "/" character. Such a path is known as a fully qualified pathname.
1018 Fully qualified paths may, obviously, not be further extended, as, by
1019 definition, no directory contains the root directory. Being unnamed,
1020 it cannot be represented in any other directory. A fully qualified
1021 pathname is valid to reference the named file or directory from any
1022 location (that is, regardless of what the current working directory
1023 may be) in the virtual file store.
1025 Any pathname that is not a fully qualified pathname may be referred
1026 to as a "relative pathname" and will only correctly reference the
1027 intended file when the current working directory of the server-FTP is
1028 a directory from which the relative pathname is valid.
1030 As a special case, the pathname "/" is defined to be a fully
1031 qualified pathname referring to the root directory. That is, the
1032 root directory does not have a directory (or file) name, but does
1033 have a pathname. This special pathname may be used only as is as a
1034 reference to the root directory. It may not be combined with other
1035 pathnames using the rules above, as doing so would lead to a pathname
1036 containing two consecutive "/" characters, which is an undefined
1041 + It is not required, or expected, that there be only one fully
1042 qualified pathname that will reference any particular file or
1045 + As a caveat, though the TVFS file store is basically tree
1046 structured, there is no requirement that any file or directory
1047 have only one parent directory.
1049 + As defined, no TVFS pathname will ever contain two consecutive "/"
1050 characters. Such a name is not illegal however, and may be
1051 defined by the server for any purpose that suits it. Clients
1052 implementing this specification should not assume any semantics
1055 + Similarly, other than the special case path that refers to the
1056 root directory, no TVFS pathname constructed as defined here will
1057 ever end with the "/" character. Such names are also not illegal,
1060 + While any legal IS10646 character is permitted to occur in a TVFS
1061 file or directory name, other than "/", server FTP implementations
1062 are not required to support all possible IS10646 characters. The
1066 Hethmon Standards Track [Page 19]
1068 RFC 3659 Extensions to FTP March 2007
1071 subset supported is entirely at the discretion of the server. The
1072 case (where it exists) of the characters that make up file,
1073 directory, and pathnames may be significant. Unless determined
1074 otherwise by means unspecified here, clients should assume that
1075 all such names are comprised of characters whose case is
1076 significant. Servers are free to treat case (or any other
1077 attribute) of a name as irrelevant, and hence map two names that
1078 appear to be distinct onto the same underlying file.
1080 + There are no defined "magic" names, like ".", ".." or "C:".
1081 Servers may implement such names, with any semantics they choose,
1082 but are not required to do so.
1084 + TVFS imposes no particular semantics or properties upon files,
1085 guarantees no access control schemes, or any of the other common
1086 properties of a file store. Only the naming scheme is defined.
1088 6.3. FEAT Response for TVFS
1090 In response to the FEAT command [6] a server that wishes to indicate
1091 support for the TVFS as defined here will include a line that begins
1092 with the four characters "TVFS" (in any case, or mixture of cases,
1093 upper case is not required). Servers SHOULD send upper case.
1095 Such a response to the FEAT command MUST NOT be returned unless the
1096 server implements TVFS as defined here.
1098 Later specifications may add to the TVFS definition. Such additions
1099 should be notified by means of additional text appended to the TVFS
1100 feature line. Such specifications, if any, will define the extra
1103 Until such a specification is defined, servers should not include
1104 anything after "TVFS" in the TVFS feature line. Clients, however,
1105 should be prepared to deal with arbitrary text following the four
1106 defined characters, and simply ignore it if unrecognized.
1108 A typical response to the FEAT command issued by a server
1109 implementing only this specification would be:
1112 S> 211- <any descriptive text>
1122 Hethmon Standards Track [Page 20]
1124 RFC 3659 Extensions to FTP March 2007
1127 The ellipses indicate place holders where other features may be
1128 included, but are not required. The one-space indentation of the
1129 feature lines is mandatory [6] and is not counted as one of the first
1130 four characters for the purposes of this feature listing.
1132 The TVFS feature adds no new commands to the FTP command repertoire.
1136 There are no options in this TVFS specification, and hence there is
1137 no OPTS command defined.
1141 Assume a TVFS file store is comprised of a root directory, which
1142 contains two directories (A and B) and two non-directory files (X and
1143 Y). The A directory contains two directories (C and D) and one other
1144 file (Z). The B directory contains just two non-directory files (P
1145 and Q) and the C directory also two non-directory files (also named P
1146 and Q, by chance). The D directory is empty, that is, contains no
1147 files or directories. This structure may depicted graphically as...
1160 Given this structure, the following fully qualified pathnames exist.
1178 Hethmon Standards Track [Page 21]
1180 RFC 3659 Extensions to FTP March 2007
1183 It is clear that none of the paths / /A /B or /A/D refer to the same
1184 directory, as the contents of each is different. Nor do any of / /A
1185 /A/C or /A/D. However /A/C and /B might be the same directory, there
1186 is insufficient information given to tell. Any of the other
1187 pathnames (/X /Y /A/Z /A/C/P /A/C/Q /B/P and /B/Q) may refer to the
1188 same underlying files, in almost any combination.
1190 If the current working directory of the server-FTP is /A then the
1191 following pathnames, in addition to all the fully qualified
1192 pathnames, are valid
1200 These all refer to the same files or directories as the corresponding
1201 fully qualified path with "/A/" prepended.
1203 That those pathnames all exist does not imply that the TVFS sever
1204 will necessarily grant any kind of access rights to the named paths,
1205 or that access to the same file via different pathnames will
1206 necessarily be granted equal rights.
1208 None of the following relative paths are valid when the current
1220 Any of those could be made valid by changing the server-FTP's current
1221 working directory to the appropriate directory. Note that the paths
1222 "P" and "Q" might refer to different files depending upon which
1223 directory is selected to cause those to become valid TVFS relative
1234 Hethmon Standards Track [Page 22]
1236 RFC 3659 Extensions to FTP March 2007
1239 7. Listings for Machine Processing (MLST and MLSD)
1241 The MLST and MLSD commands are intended to standardize the file and
1242 directory information returned by the server-FTP process. These
1243 commands differ from the LIST command in that the format of the
1244 replies is strictly defined although extensible.
1246 Two commands are defined, MLST and MLSD. MLST provides data about
1247 exactly the object named on its command line, and no others. MLSD,
1248 on the other, lists the contents of a directory if a directory is
1249 named, otherwise a 501 reply is returned. In either case, if no
1250 object is named, the current directory is assumed. That will cause
1251 MLST to send a one-line response, describing the current directory
1252 itself, and MLSD to list the contents of the current directory.
1254 In the following, the term MLSx will be used wherever either MLST or
1255 MLSD may be inserted.
1257 The MLST and MLSD commands also extend the FTP protocol as presented
1258 in STD 9, RFC 959 [3] and STD 3, RFC 1123 [9] to allow that
1259 transmission of 8-bit data over the control connection. Note this is
1260 not specifying character sets which are 8-bit, but specifying that
1261 FTP implementations are to specifically allow the transmission and
1262 reception of 8-bit bytes, with all bits significant, over the control
1263 connection. That is, all 256 possible octet values are permitted.
1264 The MLSx command allows both UTF-8/Unicode and "raw" forms as
1265 arguments, and in responses both to the MLST and MLSD commands, and
1266 all other FTP commands which take pathnames as arguments.
1268 7.1. Format of MLSx Requests
1270 The MLST and MLSD commands each allow a single optional argument.
1271 This argument may be either a directory name or, for MLST only, a
1272 file name. For these purposes, a "file name" is the name of any
1273 entity in the server NVFS which is not a directory. Where TVFS is
1274 supported, any TVFS relative pathname valid in the current working
1275 directory, or any TVFS fully qualified pathname, may be given. If a
1276 directory name is given then MLSD must return a listing of the
1277 contents of the named directory, otherwise it issues a 501 reply, and
1278 does not open a data connection. In all cases for MLST, a single set
1279 of fact lines (usually a single fact line) containing the information
1280 about the named file or directory shall be returned over the control
1281 connection, without opening a data connection.
1283 If no argument is given then MLSD must return a listing of the
1284 contents of the current working directory, and MLST must return a
1285 listing giving information about the current working directory
1286 itself. For these purposes, the contents of a directory are whatever
1290 Hethmon Standards Track [Page 23]
1292 RFC 3659 Extensions to FTP March 2007
1295 file or directory names (not pathnames) the server-PI will allow to
1296 be referenced when the current working directory is the directory
1297 named, and which the server-PI desires to reveal to the user-PI.
1298 Note that omitting the argument is the only defined way to obtain a
1299 listing of the current directory, unless a pathname that represents
1300 the directory happens to be known. In particular, there is no
1301 defined shorthand name for the current directory. This does not
1302 prohibit any particular server-PI implementing such a shorthand.
1304 No title, header, or summary, lines, or any other formatting, other
1305 than as is specified below, is ever returned in the output of an MLST
1308 If the Client-FTP sends an invalid argument, the server-FTP MUST
1309 reply with an error code of 501.
1311 The syntax for the MLSx command is:
1313 mlst = "MLst" [ SP pathname ] CRLF
1314 mlsd = "MLsD" [ SP pathname ] CRLF
1316 7.2. Format of MLSx Response
1318 The format of a response to an MLSx command is as follows:
1320 mlst-response = control-response / error-response
1321 mlsd-response = ( initial-response final-response ) /
1324 control-response = "250-" [ response-message ] CRLF
1326 "250" [ SP response-message ] CRLF
1328 initial-response = "150" [ SP response-message ] CRLF
1329 final-response = "226" SP response-message CRLF
1331 response-message = *TCHAR
1333 data-response = *( entry CRLF )
1335 entry = [ facts ] SP pathname
1336 facts = 1*( fact ";" )
1337 fact = factname "=" value
1338 factname = "Size" / "Modify" / "Create" /
1339 "Type" / "Unique" / "Perm" /
1340 "Lang" / "Media-Type" / "CharSet" /
1341 os-depend-fact / local-fact
1342 os-depend-fact = <IANA assigned OS name> "." token
1346 Hethmon Standards Track [Page 24]
1348 RFC 3659 Extensions to FTP March 2007
1351 local-fact = "X." token
1354 Upon receipt of an MLSx command, the server will verify the
1355 parameter, and if invalid return an error-response. For this
1356 purpose, the parameter should be considered to be invalid if the
1357 client issuing the command does not have permission to perform the
1358 requested operation.
1360 If the parameter is valid, then for an MLST command, the server-PI
1361 will send the first (leading) line of the control response, the entry
1362 for the pathname given, or the current directory if no pathname was
1363 provided, and the terminating line. Normally exactly one entry would
1364 be returned, more entries are permitted only when required to
1365 represent a file that is to have multiple "Type" facts returned. In
1366 this case, the pathname component of every response MUST be
1369 Note that for MLST the fact set is preceded by a space. That is
1370 provided to guarantee that the fact set cannot be accidentally
1371 interpreted as the terminating line of the control response, but is
1372 required even when that would not be possible. Exactly one space
1373 exists between the set of facts and the pathname. Where no facts are
1374 present, there will be exactly two leading spaces before the
1375 pathname. No spaces are permitted in the facts, any other spaces in
1376 the response are to be treated as being a part of the pathname.
1378 If the command was an MLSD command, the server will open a data
1379 connection as indicated in section 3.2 of STD 9, RFC 959 [3]. If
1380 that fails, the server will return an error-response. If all is OK,
1381 the server will return the initial-response, send the appropriate
1382 data-response over the new data connection, close that connection,
1383 and then send the final-response over the control connection. The
1384 grammar above defines the format for the data-response, which defines
1385 the format of the data returned over the data connection established.
1387 The data connection opened for a MLSD response shall be a connection
1388 as if the "TYPE L 8", "MODE S", and "STRU F" commands had been given,
1389 whatever FTP transfer type, mode and structure had actually been set,
1390 and without causing those settings to be altered for future commands.
1391 That is, this transfer type shall be set for the duration of the data
1392 connection established for this command only. While the content of
1393 the data sent can be viewed as a series of lines, implementations
1394 should note that there is no maximum line length defined.
1395 Implementations should be prepared to deal with arbitrarily long
1402 Hethmon Standards Track [Page 25]
1404 RFC 3659 Extensions to FTP March 2007
1407 The facts part of the specification would contain a series of "file
1408 facts" about the file or directory named on the same line. Typical
1409 information to be presented would include file size, last
1410 modification time, creation time, a unique identifier, and a
1411 file/directory flag.
1413 The complete format for a successful reply to the MLSD command would
1416 facts SP pathname CRLF
1417 facts SP pathname CRLF
1418 facts SP pathname CRLF
1421 Note that the format is intended for machine processing, not human
1422 viewing, and as such the format is very rigid. Implementations MUST
1423 NOT vary the format by, for example, inserting extra spaces for
1424 readability, replacing spaces by tabs, including header or title
1425 lines, or inserting blank lines, or in any other way alter this
1426 format. Exactly one space is always required after the set of facts
1427 (which may be empty). More spaces may be present on a line if, and
1428 only if, the pathname presented contains significant spaces. The set
1429 of facts must not contain any spaces anywhere inside it. Facts
1430 should be provided in each output line only if they both provide
1431 relevant information about the file named on the same line, and they
1432 are in the set requested by the user-PI. See section 7.9 (page 51).
1433 There is no requirement that the same set of facts be provided for
1434 each file, or that the facts presented occur in the same order for
1437 7.2.1. Error Responses to MLSx commands
1439 Many of the 4xy and 5xy responses defined in section 4.2 of STD 9,
1440 RFC 959 [3] are possible in response to the MLST and MLSD commands.
1441 In particular, syntax errors can generate 500 or 501 replies. Giving
1442 a pathname that exists but is not a directory as the argument to a
1443 MLSD command generates a 501 reply. Giving a name that does not
1444 exist, or for which access permission (to obtain directory
1445 information as requested) is not granted will elicit a 550 reply.
1446 Other replies (530, 553, 503, 504, and any of the 4xy replies) are
1447 also possible in appropriate circumstances.
1449 7.3. File Name Encoding
1451 An FTP implementation supporting the MLSx commands must be 8-bit
1452 clean. This is necessary in order to transmit UTF-8 encoded file
1453 names. This specification recommends the use of UTF-8 encoded file
1458 Hethmon Standards Track [Page 26]
1460 RFC 3659 Extensions to FTP March 2007
1463 names. FTP implementations SHOULD use UTF-8 whenever possible to
1464 encourage the maximum inter-operability.
1466 File names are not restricted to UTF-8, however treatment of
1467 arbitrary character encodings is not specified by this standard.
1468 Applications are encouraged to treat non-UTF-8 encodings of file
1469 names as octet sequences.
1471 Note that this encoding is unrelated to that of the contents of the
1472 file, even if the file contains character data.
1474 Further information about file name encoding for FTP may be found in
1475 "Internationalization of the File Transfer Protocol" [7].
1477 7.3.1. Notes about the File Name
1479 The file name returned in the MLST response should be the same name
1480 as was specified in the MLST command, or, where TVFS is supported, a
1481 fully qualified TVFS path naming the same file. Where no argument
1482 was given to the MLST command, the server-PI may either include an
1483 empty file name in the response, or it may supply a name that refers
1484 to the current directory, if such a name is available. Where TVFS is
1485 supported, a fully qualified pathname of the current directory SHOULD
1488 File names returned in the output from an MLSD command SHOULD be
1489 unqualified names within the directory named, or the current
1490 directory if no argument was given. That is, the directory named in
1491 the MLSD command SHOULD NOT appear as a component of the file names
1494 If the server-FTP process is able, and the "type" fact is being
1495 returned, it MAY return in the MLSD response, an entry whose type is
1496 "cdir", which names the directory from which the contents of the
1497 listing were obtained. Where TVFS is supported, the name MAY be the
1498 fully qualified pathname of the directory, or MAY be any other
1499 pathname that is valid to refer to that directory from the current
1500 working directory of the server-FTP. Where more than one name
1501 exists, multiple of these entries may be returned. In a sense, the
1502 "cdir" entry can be viewed as a heading for the MLSD output.
1503 However, it is not required to be the first entry returned, and may
1504 occur anywhere within the listing.
1506 When TVFS is supported, a user-PI can refer to any file or directory
1507 in the listing by combining a type "cdir" name, with the appropriate
1508 name from the directory listing using the procedure defined in
1514 Hethmon Standards Track [Page 27]
1516 RFC 3659 Extensions to FTP March 2007
1519 Alternatively, whether TVFS is supported or not, the user-PI can
1520 issue a CWD command ([3]) giving a name of type "cdir" from the
1521 listing returned, and from that point reference the files returned in
1522 the MLSD response from which the cdir was obtained by using the file
1523 name components of the listing.
1525 7.4. Format of Facts
1527 The "facts" for a file in a reply to a MLSx command consist of
1528 information about that file. The facts are a series of keyword=value
1529 pairs each followed by semi-colon (";") characters. An individual
1530 fact may not contain a semi-colon in its name or value. The complete
1531 series of facts may not contain the space character. See the
1532 definition or "RCHAR" in section 2.1 for a list of the characters
1533 that can occur in a fact value. Not all are applicable to all facts.
1535 A sample of a typical series of facts would be: (spread over two
1536 lines for presentation here only)
1538 size=4161;lang=en-US;modify=19970214165800;create=19961001124534;
1539 type=file;x.myfact=foo,bar;
1543 This document defines a standard set of facts as follows:
1545 size -- Size in octets
1546 modify -- Last modification time
1547 create -- Creation time
1549 unique -- Unique id of file/directory
1550 perm -- File permissions, whether read, write, execute is
1551 allowed for the login id.
1552 lang -- Language of the file name per IANA [11] registry.
1553 media-type -- MIME media-type of file contents per IANA registry.
1554 charset -- Character set per IANA registry (if not UTF-8)
1556 Fact names are case-insensitive. Size, size, SIZE, and SiZe are the
1559 Further operating system specific keywords could be specified by
1560 using the IANA operating system name as a prefix (examples only):
1562 OS/2.ea -- OS/2 extended attributes
1563 MACOS.rf -- MacIntosh resource forks
1564 UNIX.mode -- Unix file modes (permissions)
1570 Hethmon Standards Track [Page 28]
1572 RFC 3659 Extensions to FTP March 2007
1575 Implementations may define keywords for experimental, or private use.
1576 All such keywords MUST begin with the two character sequence "x.".
1577 As type names are case independent, "x." and "X." are equivalent.
1580 x.ver -- Version information
1581 x.desc -- File description
1584 7.5.1. The Type Fact
1586 The type fact needs a special description. Part of the problem with
1587 current practices is deciding when a file is a directory. If it is a
1588 directory, is it the current directory, a regular directory, or a
1589 parent directory? The MLST specification makes this unambiguous
1590 using the type fact. The type fact given specifies information about
1591 the object listed on the same line of the MLST response.
1593 Five values are possible for the type fact:
1595 file -- a file entry
1596 cdir -- the listed directory
1597 pdir -- a parent directory
1598 dir -- a directory or sub-directory
1599 OS.name=type -- an OS or file system dependent file type
1601 The syntax is defined to be:
1603 type-fact = type-label "=" type-val
1605 type-val = "File" / "cdir" / "pdir" / "dir" /
1608 The value of the type fact (the "type-val") is a case independent
1613 The presence of the type=file fact indicates the listed entry is a
1614 file containing non-system data. That is, it may be transferred from
1615 one system to another of quite different characteristics, and perhaps
1616 still be meaningful.
1620 The type=cdir fact indicates the listed entry contains a pathname of
1621 the directory whose contents are listed. An entry of this type will
1622 only be returned as a part of the result of an MLSD command when the
1626 Hethmon Standards Track [Page 29]
1628 RFC 3659 Extensions to FTP March 2007
1631 type fact is included, and provides a name for the listed directory,
1632 and facts about that directory. In a sense, it can be viewed as
1633 representing the title of the listing, in a machine friendly format.
1634 It may appear at any point of the listing, it is not restricted to
1635 appearing at the start, though frequently may do so, and may occur
1636 multiple times. It MUST NOT be included if the type fact is not
1637 included, or there would be no way for the user-PI to distinguish the
1638 name of the directory from an entry in the directory.
1640 Where TVFS is supported by the server-FTP, this name may be used to
1641 construct pathnames with which to refer to the files and directories
1642 returned in the same MLSD output (see section 6.2). These pathnames
1643 are only expected to work when the server-PI's position in the NVFS
1644 file tree is the same as its position when the MLSD command was
1645 issued, unless a fully qualified pathname results.
1647 Where TVFS is not supported, the only defined semantics associated
1648 with a "type=cdir" entry are that, provided the current working
1649 directory of the server-PI has not been changed, a pathname of type
1650 "cdir" may be used as an argument to a CWD command, which will cause
1651 the current directory of the server-PI to change so that the
1652 directory that was listed in its current working directory.
1656 If present, the type=dir entry gives the name of a directory. Such
1657 an entry typically cannot be transferred from one system to another
1658 using RETR, etc., but should (permissions permitting) be able to be
1659 the object of an MLSD command.
1663 If present, which will occur only in the response to a MLSD command
1664 when the type fact is included, the type=pdir entry represents a
1665 pathname of the parent directory of the listed directory. As well as
1666 having the properties of a type=dir, a CWD command that uses the
1667 pathname from this entry should change the user to a parent directory
1668 of the listed directory. If the listed directory is the current
1669 directory, a CDUP command may also have the effect of changing to the
1670 named directory. User-FTP processes should note not all responses
1671 will include this information, and that some systems may provide
1672 multiple type=pdir responses.
1674 Where TVFS is supported, a "type=pdir" name may be a relative
1675 pathname, or a fully qualified pathname. A relative pathname will be
1676 relative to the directory being listed, not to the current directory
1677 of the server-PI at the time.
1682 Hethmon Standards Track [Page 30]
1684 RFC 3659 Extensions to FTP March 2007
1687 For the purposes of this type value, a "parent directory" is any
1688 directory in which there is an entry of type=dir that refers to the
1689 directory in which the type=pdir entity was found. Thus it is not
1690 required that all entities with type=pdir refer to the same
1691 directory. The "unique" fact (if supported and supplied) can be used
1692 to determine whether there is a relationship between the type=pdir
1695 7.5.1.5. System Defined Types
1697 Files types that are specific to a specific operating system, or file
1698 system, can be encoded using the "OS." type names. The format is:
1700 os-type = "OS." os-name "=" os-kind
1701 os-name = <an IANA registered operating system name>
1704 The "os-name" indicates the specific system type that supports the
1705 particular localtype. OS specific types are registered by the IANA
1706 using the procedures specified in section 10. The "os-kind" provides
1707 the system dependent information as to the type of the file listed.
1708 The os-name and os-kind strings in an os-type are case independent.
1709 "OS.unix=block" and "OS.Unix=BLOCK" represent the same type (or
1710 would, if such a type were registered.)
1712 Note: Where the underlying system supports a file type that is
1713 essentially an indirect pointer to another file, the NVFS
1714 representation of that type should normally be to represent the file
1715 that the reference indicates. That is, the underlying basic file
1716 will appear more than once in the NVFS, each time with the "unique"
1717 fact (see immediately following section) containing the same value,
1718 indicating that the same file is represented by all such names.
1719 User-PIs transferring the file need then transfer it only once, and
1720 then insert their own form of indirect reference to construct
1721 alternate names where desired, or perhaps even copy the local file if
1722 that is the only way to provide two names with the same content. A
1723 file which would be a reference to another file, if only the other
1724 file actually existed, may be represented in any OS dependent manner
1725 appropriate, or not represented at all.
1727 7.5.1.6. Multiple Types
1729 Where a file is such that it may validly, and sensibly, treated by
1730 the server-PI as being of more than one of the above types, then
1731 multiple entries should be returned, each with its own "Type" fact of
1732 the appropriate type, and each containing the same pathname. This
1733 may occur, for example, with a structured file, which may contain
1734 sub-files, and where the server-PI permits the structured file to be
1738 Hethmon Standards Track [Page 31]
1740 RFC 3659 Extensions to FTP March 2007
1743 treated as a unit, or treated as a directory allowing the sub-files
1744 within it to be referenced. When this is done, the pathname returned
1745 with each entry MUST be identical to the others representing the same
1748 7.5.2. The unique Fact
1750 The unique fact is used to present a unique identifier for a file or
1751 directory in the NVFS accessed via a server-FTP process. The value
1752 of this fact should be the same for any number of pathnames that
1753 refer to the same underlying file. The fact should have different
1754 values for names that reference distinct files. The mapping between
1755 files, and unique fact tokens should be maintained, and remain
1756 consistent, for at least the lifetime of the control connection from
1757 user-PI to server-PI.
1759 unique-fact = "Unique" "=" token
1761 This fact would be expected to be used by server-FTPs whose host
1762 system allows things such as symbolic links so that the same file may
1763 be represented in more than one directory on the server. The only
1764 conclusion that should be drawn is that if two different names each
1765 have the same value for the unique fact, they refer to the same
1766 underlying object. The value of the unique fact (the token) should
1767 be considered an opaque string for comparison purposes, and is a case
1768 dependent value. The tokens "A" and "a" do not represent the same
1771 7.5.3. The modify Fact
1773 The modify fact is used to determine the last time the content of the
1774 file (or directory) indicated was modified. Any change of substance
1775 to the file should cause this value to alter. That is, if a change
1776 is made to a file such that the results of a RETR command would
1777 differ, then the value of the modify fact should alter. User-PIs
1778 should not assume that a different modify fact value indicates that
1779 the file contents are necessarily different than when last retrieved.
1780 Some systems may alter the value of the modify fact for other
1781 reasons, though this is discouraged wherever possible. Also a file
1782 may alter, and then be returned to its previous content, which would
1783 often be indicated as two incremental alterations to the value of the
1786 For directories, this value should alter whenever a change occurs to
1787 the directory such that different file names would (or might) be
1788 included in MLSD output of that directory.
1790 modify-fact = "Modify" "=" time-val
1794 Hethmon Standards Track [Page 32]
1796 RFC 3659 Extensions to FTP March 2007
1799 7.5.4. The create Fact
1801 The create fact indicates when a file, or directory, was first
1802 created. Exactly what "creation" is for this purpose is not
1803 specified here, and may vary from server to server. About all that
1804 can be said about the value returned is that it can never indicate a
1805 later time than the modify fact.
1807 create-fact = "Create" "=" time-val
1809 Implementation Note: Implementors of this fact on UNIX(TM) systems
1810 should note that the unix "stat" "st_ctime" field does not give
1811 creation time, and that unix file systems do not record creation
1812 time at all. Unix (and POSIX) implementations will normally not
1815 7.5.5. The perm Fact
1817 The perm fact is used to indicate access rights the current FTP user
1818 has over the object listed. Its value is always an unordered
1819 sequence of alphabetic characters.
1821 perm-fact = "Perm" "=" *pvals
1822 pvals = "a" / "c" / "d" / "e" / "f" /
1823 "l" / "m" / "p" / "r" / "w"
1825 There are ten permission indicators currently defined. Many are
1826 meaningful only when used with a particular type of object. The
1827 indicators are case independent, "d" and "D" are the same indicator.
1829 The "a" permission applies to objects of type=file, and indicates
1830 that the APPE (append) command may be applied to the file named.
1832 The "c" permission applies to objects of type=dir (and type=pdir,
1833 type=cdir). It indicates that files may be created in the directory
1834 named. That is, that a STOU command is likely to succeed, and that
1835 STOR and APPE commands might succeed if the file named did not
1836 previously exist, but is to be created in the directory object that
1837 has the "c" permission. It also indicates that the RNTO command is
1838 likely to succeed for names in the directory.
1840 The "d" permission applies to all types. It indicates that the
1841 object named may be deleted, that is, that the RMD command may be
1842 applied to it if it is a directory, and otherwise that the DELE
1843 command may be applied to it.
1845 The "e" permission applies to the directory types. When set on an
1846 object of type=dir, type=cdir, or type=pdir it indicates that a CWD
1850 Hethmon Standards Track [Page 33]
1852 RFC 3659 Extensions to FTP March 2007
1855 command naming the object should succeed, and the user should be able
1856 to enter the directory named. For type=pdir it also indicates that
1857 the CDUP command may succeed (if this particular pathname is the one
1858 to which a CDUP would apply.)
1860 The "f" permission for objects indicates that the object named may be
1861 renamed - that is, may be the object of an RNFR command.
1863 The "l" permission applies to the directory file types, and indicates
1864 that the listing commands, LIST, NLST, and MLSD may be applied to the
1865 directory in question.
1867 The "m" permission applies to directory types, and indicates that the
1868 MKD command may be used to create a new directory within the
1869 directory under consideration.
1871 The "p" permission applies to directory types, and indicates that
1872 objects in the directory may be deleted, or (stretching naming a
1873 little) that the directory may be purged. Note: it does not indicate
1874 that the RMD command may be used to remove the directory named
1875 itself, the "d" permission indicator indicates that.
1877 The "r" permission applies to type=file objects, and for some
1878 systems, perhaps to other types of objects, and indicates that the
1879 RETR command may be applied to that object.
1881 The "w" permission applies to type=file objects, and for some
1882 systems, perhaps to other types of objects, and indicates that the
1883 STOR command may be applied to the object named.
1885 Note: That a permission indicator is set can never imply that the
1886 appropriate command is guaranteed to work -- just that it might.
1887 Other system specific limitations, such as limitations on
1888 available space for storing files, may cause an operation to fail,
1889 where the permission flags may have indicated that it was likely
1890 to succeed. The permissions are a guide only.
1892 Implementation note: The permissions are described here as they apply
1893 to FTP commands. They may not map easily into particular
1894 permissions available on the server's operating system. Servers
1895 are expected to synthesize these permission bits from the
1896 permission information available from operating system. For
1897 example, to correctly determine whether the "D" permission bit
1898 should be set on a directory for a server running on the UNIX(TM)
1899 operating system, the server should check that the directory named
1900 is empty, and that the user has write permission on both the
1901 directory under consideration, and its parent directory.
1906 Hethmon Standards Track [Page 34]
1908 RFC 3659 Extensions to FTP March 2007
1911 Some systems may have more specific permissions than those listed
1912 here, such systems should map those to the flags defined as best
1913 they are able. Other systems may have only more broad access
1914 controls. They will generally have just a few possible
1915 permutations of permission flags, however they should attempt to
1916 correctly represent what is permitted.
1918 7.5.6. The lang Fact
1920 The lang fact describes the natural language of the file name for use
1921 in display purposes. Values used here should be taken from the
1922 language registry of the IANA. See [12] for the syntax, and
1923 procedures, related to language tags.
1925 lang-fact = "Lang" "=" token
1927 Server-FTP implementations MUST NOT guess language values. Language
1928 values must be determined in an unambiguous way such as file system
1929 tagging of language or by user configuration. Note that the lang
1930 fact provides no information at all about the content of a file, only
1931 about the encoding of its name.
1933 7.5.7. The size Fact
1935 The size fact applies to non-directory file types and should always
1936 reflect the approximate size of the file. This should be as accurate
1937 as the server can make it, without going to extraordinary lengths,
1938 such as reading the entire file. The size is expressed in units of
1939 octets of data in the file.
1941 Given limitations in some systems, Client-FTP implementations must
1942 understand this size may not be precise and may change between the
1943 time of a MLST and RETR operation.
1945 Clients that need highly accurate size information for some
1946 particular reason should use the SIZE command as defined in section
1947 4. The most common need for this accuracy is likely to be in
1948 conjunction with the REST command described in section 5. The size
1949 fact, on the other hand, should be used for purposes such as
1950 indicating to a human user the approximate size of the file to be
1951 transferred, and perhaps to give an idea of expected transfer
1954 size-fact = "Size" "=" 1*DIGIT
1962 Hethmon Standards Track [Page 35]
1964 RFC 3659 Extensions to FTP March 2007
1967 7.5.8. The media-type Fact
1969 The media-type fact represents the IANA media type of the file named,
1970 and applies only to non-directory types. The list of values used
1971 must follow the guidelines set by the IANA registry.
1973 media-type = "Media-Type" "=" <per IANA guidelines>
1975 Server-FTP implementations MUST NOT guess media type values. Media
1976 type values must be determined in an unambiguous way such as file
1977 system tagging of media-type or by user configuration. This fact
1978 gives information about the content of the file named. Both the
1979 primary media type, and any appropriate subtype should be given,
1980 separated by a slash "/" as is traditional.
1982 7.5.9. The charset Fact
1984 The charset fact provides the IANA character set name, or alias, for
1985 the encoded pathnames in a MLSx response. The default character set
1986 is UTF-8 unless specified otherwise. FTP implementations SHOULD use
1987 UTF-8 if possible to encourage maximum inter-operability. The value
1988 of this fact applies to the pathname only, and provides no
1989 information about the contents of the file.
1991 charset-type = "Charset" "=" token
1993 7.5.10. Required Facts
1995 Servers are not required to support any particular set of the
1996 available facts. However, servers SHOULD, if conceivably possible,
1997 support at least the type, perm, size, unique, and modify facts.
1999 7.6. System Dependent and Local Facts
2001 By using an system dependent fact, or a local fact, a server-PI may
2002 communicate to the user-PI information about the file named that is
2003 peculiar to the underlying file system.
2005 7.6.1. System Dependent Facts
2007 System dependent fact names are labeled by prefixing a label
2008 identifying the specific information returned by the name of the
2009 appropriate operating system from the IANA maintained list of
2010 operating system names.
2012 The value of an OS dependent fact may be whatever is appropriate to
2013 convey the information available. It must be encoded as a "token" as
2014 defined in section 2.1 however.
2018 Hethmon Standards Track [Page 36]
2020 RFC 3659 Extensions to FTP March 2007
2023 In order to allow reliable inter-operation between users of system
2024 dependent facts, the IANA will maintain a registry of system
2025 dependent fact names, their syntax, and the interpretation to be
2026 given to their values. Registrations of system dependent facts are
2027 to be accomplished according to the procedures of section 10.
2031 Implementations may also make available other facts of their own
2032 choosing. As the method of interpretation of such information will
2033 generally not be widely understood, server-PIs should be aware that
2034 clients will typically ignore any local facts provided. As there is
2035 no registration of locally defined facts, it is entirely possible
2036 that different servers will use the same local fact name to provide
2037 vastly different information. Hence user-PIs should be hesitant
2038 about making any use of any information in a locally defined fact
2039 without some other specific assurance that the particular fact is one
2040 that they do comprehend.
2042 Local fact names all begin with the sequence "X.". The rest of the
2043 name is a "token" (see section 2.1). The value of a local fact can
2044 be anything at all, provided it can be encoded as a "token".
2048 The following examples are all taken from dialogues between existing
2049 FTP clients and servers. Because of this, not all possible
2050 variations of possible response formats are shown in the examples.
2051 This should not be taken as limiting the options of other server
2052 implementors. Where the examples show OS dependent information, that
2053 is to be treated as being purely for the purposes of demonstration of
2054 some possible OS specific information that could be defined. As at
2055 the time of the writing of this document, no OS specific facts or
2056 file types have been defined, the examples shown here should not be
2057 treated as in any way to be preferred over other possible similar
2058 definitions. Consult the IANA registries to determine what types and
2059 facts have been defined. Finally also beware that as the examples
2060 shown are taken from existing implementations, coded before this
2061 document was completed, the possibility of variations between the
2062 text of this document and the examples exists. In any such case of
2063 inconsistency, the example is to be treated as incorrect.
2065 In the examples shown, only relevant commands and responses have been
2066 included. This is not to imply that other commands (including
2067 authentication, directory modification, PORT or PASV commands, or
2068 similar) would not be present in an actual connection, or were not,
2069 in fact, actually used in the examples before editing. Note also
2070 that the formats shown are those that are transmitted between client
2074 Hethmon Standards Track [Page 37]
2076 RFC 3659 Extensions to FTP March 2007
2079 and server, not formats that would normally ever be reported to the
2085 S> 257 "/tmp" is current directory.
2086 C> MLst cap60.pl198.tar.gz
2087 S> 250- Listing cap60.pl198.tar.gz
2088 S> Type=file;Size=1024990;Perm=r; /tmp/cap60.pl198.tar.gz
2091 The client first asked to be told the current directory of the
2092 server. This was purely for the purposes of clarity of this example.
2093 The client then requested facts about a specific file. The server
2094 returned the "250-" first control-response line, followed by a single
2095 line of facts about the file, followed by the terminating "250 "
2096 line. The text on the control-response line and the terminating line
2097 can be anything the server decides to send. Notice that the fact
2098 line is indented by a single space. Notice also that there are no
2099 spaces in the set of facts returned, until the single space before
2100 the file name. The file name returned on the fact line is a fully
2101 qualified pathname of the file listed. The facts returned show that
2102 the line refers to a file, that file contains approximately 1024990
2103 bytes, though more or less than that may be transferred if the file
2104 is retrieved, and a different number may be required to store the
2105 file at the client's file store, and the connected user has
2106 permission to retrieve the file but not to do anything else
2107 particularly interesting.
2109 7.7.2. MLST of a directory
2112 S> 257 "/" is current directory.
2115 S> Type=dir;Modify=19981107085215;Perm=el; /tmp
2118 Again the PWD is just for the purposes of demonstration for the
2119 example. The MLST fact line this time shows that the file listed is
2120 a directory, that it was last modified at 08:52:15 on the 7th of
2121 November, 1998 UTC, and that the user has permission to enter the
2122 directory, and to list its contents, but not to modify it in any way.
2123 Again, the fully qualified pathname of the directory listed is given.
2130 Hethmon Standards Track [Page 38]
2132 RFC 3659 Extensions to FTP March 2007
2135 7.7.3. MLSD of a directory
2138 S> 150 BINARY connection open for MLSD tmp
2139 D> Type=cdir;Modify=19981107085215;Perm=el; tmp
2140 D> Type=cdir;Modify=19981107085215;Perm=el; /tmp
2141 D> Type=pdir;Modify=19990112030508;Perm=el; ..
2142 D> Type=file;Size=25730;Modify=19940728095854;Perm=; capmux.tar.z
2143 D> Type=file;Size=1830;Modify=19940916055648;Perm=r; hatch.c
2144 D> Type=file;Size=25624;Modify=19951003165342;Perm=r; MacIP-02.txt
2145 D> Type=file;Size=2154;Modify=19950501105033;Perm=r; uar.netbsd.patch
2146 D> Type=file;Size=54757;Modify=19951105101754;Perm=r; iptnnladev.1.0.sit.hqx
2147 D> Type=file;Size=226546;Modify=19970515023901;Perm=r; melbcs.tif
2148 D> Type=file;Size=12927;Modify=19961025135602;Perm=r; tardis.1.6.sit.hqx
2149 D> Type=file;Size=17867;Modify=19961025135602;Perm=r; timelord.1.4.sit.hqx
2150 D> Type=file;Size=224907;Modify=19980615100045;Perm=r; uar.1.2.3.sit.hqx
2151 D> Type=file;Size=1024990;Modify=19980130010322;Perm=r; cap60.pl198.tar.gz
2152 S> 226 MLSD completed
2154 In this example notice that there is no leading space on the fact
2155 lines returned over the data connection. Also notice that two lines
2156 of "type=cdir" have been given. These show two alternate names for
2157 the directory listed, one a fully qualified pathname, and the other a
2158 local name relative to the servers current directory when the MLSD
2159 was performed. Note that all other file names in the output are
2160 relative to the directory listed, though the server could, if it
2161 chose, give a fully qualified pathname for the "type=pdir" line.
2162 This server has chosen not to. The other files listed present a
2163 fairly boring set of files that are present in the listed directory.
2164 Note that there is no particular order in which they are listed.
2165 They are not sorted by file name, by size, or by modify time. Note
2166 also that the "perm" fact has an empty value for the file
2167 "capmux.tar.z" indicating that the connected user has no permissions
2168 at all for that file. This server has chosen to present the "cdir"
2169 and "pdir" lines before the lines showing the content of the
2170 directory, it is not required to do so. The "size" fact does not
2171 provide any meaningful information for a directory, so is not
2172 included in the fact lines for the directory types shown.
2186 Hethmon Standards Track [Page 39]
2188 RFC 3659 Extensions to FTP March 2007
2191 7.7.4. A More Complex Example
2194 S> 250- Listing test
2195 S> Type=dir;Perm=el;Unique=keVO1+ZF4 test
2198 S> 150 BINARY connection open for MLSD test
2199 D> Type=cdir;Perm=el;Unique=keVO1+ZF4; test
2200 D> Type=pdir;Perm=e;Unique=keVO1+d?3; ..
2201 D> Type=OS.unix=slink:/foobar;Perm=;Unique=keVO1+4G4; foobar
2202 D> Type=OS.unix=chr-13/29;Perm=;Unique=keVO1+5G4; device
2203 D> Type=OS.unix=blk-11/108;Perm=;Unique=keVO1+6G4; block
2204 D> Type=file;Perm=awr;Unique=keVO1+8G4; writable
2205 D> Type=dir;Perm=cpmel;Unique=keVO1+7G4; promiscuous
2206 D> Type=dir;Perm=;Unique=keVO1+1t2; no-exec
2207 D> Type=file;Perm=r;Unique=keVO1+EG4; two words
2208 D> Type=file;Perm=r;Unique=keVO1+IH4; leading space
2209 D> Type=file;Perm=r;Unique=keVO1+1G4; file1
2210 D> Type=dir;Perm=cpmel;Unique=keVO1+7G4; incoming
2211 D> Type=file;Perm=r;Unique=keVO1+1G4; file2
2212 D> Type=file;Perm=r;Unique=keVO1+1G4; file3
2213 D> Type=file;Perm=r;Unique=keVO1+1G4; file4
2214 S> 226 MLSD completed
2215 C> MLSD test/incoming
2216 S> 150 BINARY connection open for MLSD test/incoming
2217 D> Type=cdir;Perm=cpmel;Unique=keVO1+7G4; test/incoming
2218 D> Type=pdir;Perm=el;Unique=keVO1+ZF4; ..
2219 D> Type=file;Perm=awdrf;Unique=keVO1+EH4; bar
2220 D> Type=file;Perm=awdrf;Unique=keVO1+LH4;
2221 D> Type=file;Perm=rf;Unique=keVO1+1G4; file5
2222 D> Type=file;Perm=rf;Unique=keVO1+1G4; file6
2223 D> Type=dir;Perm=cpmdelf;Unique=keVO1+!s2; empty
2224 S> 226 MLSD completed
2226 For the purposes of this example the fact set requested has been
2227 modified to delete the "size" and "modify" facts, and add the
2228 "unique" fact. First, facts about a file name have been obtained via
2229 MLST. Note that no fully qualified pathname was given this time.
2230 That was because the server was unable to determine that information.
2231 Then having determined that the file name represents a directory,
2232 that directory has been listed. That listing also shows no fully
2233 qualified pathname, for the same reason, thus has but a single
2234 "type=cdir" line. This directory (which was created especially for
2235 the purpose) contains several interesting files. There are some with
2236 OS dependent file types, several sub-directories, and several
2242 Hethmon Standards Track [Page 40]
2244 RFC 3659 Extensions to FTP March 2007
2247 Not much can be said here about the OS dependent file types, as none
2248 of the information shown there should be treated as any more than
2249 possibilities. It can be seen that the OS type of the server is
2250 "unix" though, which is one of the OS types in the IANA registry of
2251 Operating System names.
2253 Of the three directories listed, "no-exec" has no permission granted
2254 to this user to access at all. From the "Unique" fact values, it can
2255 be determined that "promiscuous" and "incoming" in fact represent the
2256 same directory. Its permissions show that the connected user has
2257 permission to do essentially anything other than to delete the
2258 directory. That directory was later listed. It happens that the
2259 directory can not be deleted because it is not empty.
2261 Of the normal files listed, two contain spaces in their names. The
2262 file called " leading space" actually contains two spaces in its
2263 name, one before the "l" and one between the "g" and the "s". The
2264 two spaces that separate the facts from the visible part of the
2265 pathname make that clear. The file "writable" has the "a" and "w"
2266 permission bits set, and consequently the connected user should be
2267 able to STOR or APPE to that file.
2269 The other four file names, "file1", "file2", "file3", and "file4" all
2270 represent the same underlying file, as can be seen from the values of
2271 the "unique" facts of each. It happens that "file1" and "file2" are
2272 Unix "hard" links, and that "file3" and "file4" are "soft" or
2273 "symbolic" links to the first two. None of that information is
2274 available via standard MLST facts, it is sufficient for the purposes
2275 of FTP to note that all represent the same file, and that the same
2276 data would be fetched no matter which of them was retrieved, and that
2277 all would be simultaneously modified were data stored in any.
2279 Finally, the sub-directory "incoming" is listed. Since "promiscuous"
2280 is the same directory there would be no point listing it as well. In
2281 that directory, the files "file5" and "file6" represent still more
2282 names for the "file1" file we have seen before. Notice the entry
2283 between that for "bar" and "file5". Though it is not possible to
2284 easily represent it in this document, that shows a file with a name
2285 comprising exactly three spaces (" "). A client will have no
2286 difficulty determining that name from the output presented to it
2287 however. The directory "empty" is, as its name implies, empty,
2288 though that is not shown here. It can, however, be deleted, as can
2289 file "bar" and the file whose name is three spaces. All the files
2290 that reside in this directory can be renamed. This is a consequence
2291 of the UNIX semantics of the directory that contains them being
2298 Hethmon Standards Track [Page 41]
2300 RFC 3659 Extensions to FTP March 2007
2303 7.7.5. More Accurate Time Information
2306 S> 250- Listing file1
2307 S> Type=file;Modify=19990929003355.237; file1
2310 In this example, the server-FTP is indicating that "file1" was last
2311 modified 237 milliseconds after 00:33:55 UTC on the 29th of
2314 7.7.6. A Different Server
2318 S> type=dir;unique=AQkAAAAAAAABCAAA; /
2321 S> 150 Opening ASCII mode data connection for MLS.
2322 D> type=cdir;unique=AQkAAAAAAAABCAAA; /
2323 D> type=dir;unique=AQkAAAAAAAABEAAA; bin
2324 D> type=dir;unique=AQkAAAAAAAABGAAA; etc
2325 D> type=dir;unique=AQkAAAAAAAAB8AwA; halflife
2326 D> type=dir;unique=AQkAAAAAAAABoAAA; incoming
2327 D> type=dir;unique=AQkAAAAAAAABIAAA; lib
2328 D> type=dir;unique=AQkAAAAAAAABWAEA; linux
2329 D> type=dir;unique=AQkAAAAAAAABKAEA; ncftpd
2330 D> type=dir;unique=AQkAAAAAAAABGAEA; outbox
2331 D> type=dir;unique=AQkAAAAAAAABuAAA; quake2
2332 D> type=dir;unique=AQkAAAAAAAABQAEA; winstuff
2333 S> 226 Listing completed.
2335 S> 150 Opening ASCII mode data connection for MLS.
2336 D> type=cdir;unique=AQkAAAAAAAABWAEA; /linux
2337 D> type=pdir;unique=AQkAAAAAAAABCAAA; /
2338 D> type=dir;unique=AQkAAAAAAAABeAEA; firewall
2339 D> type=file;size=12;unique=AQkAAAAAAAACWAEA; helo_world
2340 D> type=dir;unique=AQkAAAAAAAABYAEA; kernel
2341 D> type=dir;unique=AQkAAAAAAAABmAEA; scripts
2342 D> type=dir;unique=AQkAAAAAAAABkAEA; security
2343 S> 226 Listing completed.
2344 C> MLSD linux/kernel
2345 S> 150 Opening ASCII mode data connection for MLS.
2346 D> type=cdir;unique=AQkAAAAAAAABYAEA; /linux/kernel
2347 D> type=pdir;unique=AQkAAAAAAAABWAEA; /linux
2348 D> type=file;size=6704;unique=AQkAAAAAAAADYAEA; k.config
2349 D> type=file;size=7269221;unique=AQkAAAAAAAACYAEA; linux-2.0.36.tar.gz
2350 D> type=file;size=12514594;unique=AQkAAAAAAAAEYAEA; linux-2.1.130.tar.gz
2354 Hethmon Standards Track [Page 42]
2356 RFC 3659 Extensions to FTP March 2007
2359 S> 226 Listing completed.
2361 Note that this server returns its "unique" fact value in quite a
2362 different format. It also returns fully qualified pathnames for the
2365 7.7.7. Some IANA Files
2368 S> 150 BINARY connection open for MLSD .
2369 D> Type=cdir;Modify=19990219183438; /iana/assignments
2370 D> Type=pdir;Modify=19990112030453; ..
2371 D> Type=dir;Modify=19990219073522; media-types
2372 D> Type=dir;Modify=19990112033515; character-set-info
2373 D> Type=dir;Modify=19990112033529; languages
2374 D> Type=file;Size=44242;Modify=19990217230400; character-sets
2375 D> Type=file;Size=1947;Modify=19990209215600; operating-system-names
2376 S> 226 MLSD completed
2378 S> 150 BINARY connection open for MLSD media-types
2379 D> Type=cdir;Modify=19990219073522; media-types
2380 D> Type=cdir;Modify=19990219073522; /iana/assignments/media-types
2381 D> Type=pdir;Modify=19990219183438; ..
2382 D> Type=dir;Modify=19990112033045; text
2383 D> Type=dir;Modify=19990219183442; image
2384 D> Type=dir;Modify=19990112033216; multipart
2385 D> Type=dir;Modify=19990112033254; video
2386 D> Type=file;Size=30249;Modify=19990218032700; media-types
2387 S> 226 MLSD completed
2388 C> MLSD character-set-info
2389 S> 150 BINARY connection open for MLSD character-set-info
2390 D> Type=cdir;Modify=19990112033515; character-set-info
2391 D> Type=cdir;Modify=19990112033515; /iana/assignments/character-set-info
2392 D> Type=pdir;Modify=19990219183438; ..
2393 D> Type=file;Size=1234;Modify=19980903020400; windows-1251
2394 D> Type=file;Size=4557;Modify=19980922001400; tis-620
2395 D> Type=file;Size=801;Modify=19970324130000; ibm775
2396 D> Type=file;Size=552;Modify=19970320130000; ibm866
2397 D> Type=file;Size=922;Modify=19960505140000; windows-1258
2398 S> 226 MLSD completed
2400 S> 150 BINARY connection open for MLSD languages
2401 D> Type=cdir;Modify=19990112033529; languages
2402 D> Type=cdir;Modify=19990112033529; /iana/assignments/languages
2403 D> Type=pdir;Modify=19990219183438; ..
2404 D> Type=file;Size=2391;Modify=19980309130000; default
2405 D> Type=file;Size=943;Modify=19980309130000; tags
2406 D> Type=file;Size=870;Modify=19971026130000; navajo
2410 Hethmon Standards Track [Page 43]
2412 RFC 3659 Extensions to FTP March 2007
2415 D> Type=file;Size=699;Modify=19950911140000; no-bok
2416 S> 226 MLSD completed
2418 S> 257 "/iana/assignments" is current directory.
2420 This example shows some of the IANA maintained files that are
2421 relevant for this specification in MLSD format. Note that these
2422 listings have been edited by deleting many entries, the actual
2423 listings are much longer.
2425 7.7.8. A Stress Test of Case (In)dependence
2427 The following example is intended to make clear some cases where case
2428 dependent strings are permitted in the MLSx commands, and where case
2429 independent strings are required.
2431 Note first that the "MLSD" command, shown here as "MlsD" is case
2432 independent. Clients may issue this command in any case, or
2433 combination of cases, they desire. This is the case for all FTP
2437 S> 150 BINARY connection open for MLSD .
2438 D> Type=pdir;Modify=19990929011228;Perm=el;Unique=keVO1+ZF4; ..
2439 D> Type=file;Size=4096;Modify=19990929011440;Perm=r;Unique=keVO1+Bd8; FILE2
2440 D> Type=file;Size=4096;Modify=19990929011440;Perm=r;Unique=keVO1+aG8; file3
2441 D> Type=file;Size=4096;Modify=19990929011440;Perm=r;Unique=keVO1+ag8; FILE3
2442 D> Type=file;Size=4096;Modify=19990929011440;Perm=r;Unique=keVO1+bD8; file1
2443 D> Type=file;Size=4096;Modify=19990929011440;Perm=r;Unique=keVO1+bD8; file2
2444 D> Type=file;Size=4096;Modify=19990929011440;Perm=r;Unique=keVO1+Ag8; File3
2445 D> Type=file;Size=4096;Modify=19990929011440;Perm=r;Unique=keVO1+bD8; File1
2446 D> Type=file;Size=4096;Modify=19990929011440;Perm=r;Unique=keVO1+Bd8; File2
2447 D> Type=file;Size=4096;Modify=19990929011440;Perm=r;Unique=keVO1+bd8; FILE1
2448 S> 226 MLSD completed
2450 Next, notice the labels of the facts. These are also case-
2451 independent strings; the server-FTP is permitted to return them in
2452 any case desired. User-FTP must be prepared to deal with any case,
2453 though it may do this by mapping the labels to a common case if
2456 Then, notice that there are nine objects of "type" file returned. In
2457 a case-independent NVFS these would represent three different file
2458 names, "file1", "file2", and "file3". With a case-dependent NVFS all
2459 nine represent different file names. Either is possible, server-FTPs
2460 may implement a case dependent or a case independent NVFS. User-FTPs
2461 must allow for case dependent selection of files to manipulate on the
2466 Hethmon Standards Track [Page 44]
2468 RFC 3659 Extensions to FTP March 2007
2471 Lastly, notice that the value of the "unique" fact is case dependent.
2472 In the example shown, "file1", "File1", and "file2" all have the same
2473 "unique" fact value "keVO1+bD8", and thus all represent the same
2474 underlying file. On the other hand, "FILE1" has a different "unique"
2475 fact value ("keVO1+bd8") and hence represents a different file.
2476 Similarly, "FILE2" and "File2" are two names for the same underlying
2477 file, whereas "file3", "File3" and "FILE3" all represent different
2480 That the approximate sizes ("size" fact) and last modification times
2481 ("modify" fact) are the same in all cases might be no more than a
2484 It is not suggested that the operators of server-FTPs create an NVFS
2485 that stresses the protocols to this extent; however, both user and
2486 server implementations must be prepared to deal with such extreme
2489 7.7.9. Example from Another Server
2492 S> 150 File Listing Follows in IMAGE / Binary mode.
2493 D> type=cdir;modify=19990426150227;perm=el; /MISC
2494 D> type=pdir;modify=19791231130000;perm=el; /
2495 D> type=dir;modify=19990426150227;perm=el; CVS
2496 D> type=dir;modify=19990426150228;perm=el; SRC
2497 S> 226 Transfer finished successfully.
2499 S> 150 File Listing Follows in IMAGE / Binary mode.
2500 D> type=cdir;modify=19990426150228;perm=el; /MISC/src
2501 D> type=pdir;modify=19990426150227;perm=el; /MISC
2502 D> type=dir;modify=19990426150228;perm=el; CVS
2503 D> type=dir;modify=19990426150228;perm=el; INSTALL
2504 D> type=dir;modify=19990426150230;perm=el; INSTALLI
2505 D> type=dir;modify=19990426150230;perm=el; TREES
2506 S> 226 Transfer finished successfully.
2508 S> 150 File Listing Follows in IMAGE / Binary mode.
2509 D> type=cdir;modify=19990426150228;perm=el; /MISC/src/install
2510 D> type=pdir;modify=19990426150228;perm=el; /MISC/src
2511 D> type=file;modify=19990406234304;perm=r;size=20059; BOOTPC.C
2512 D> type=file;modify=19980401170153;perm=r;size=278; BOOTPC.H
2513 D> type=file;modify=19990413153736;perm=r;size=54220; BOOTPC.O
2514 D> type=file;modify=19990223044003;perm=r;size=3389; CDROM.C
2515 D> type=file;modify=19990413153739;perm=r;size=30192; CDROM.O
2516 D> type=file;modify=19981119155324;perm=r;size=1055; CHANGELO
2517 D> type=file;modify=19981204171040;perm=r;size=8297; COMMANDS.C
2518 D> type=file;modify=19980508041749;perm=r;size=580; COMMANDS.H
2522 Hethmon Standards Track [Page 45]
2524 RFC 3659 Extensions to FTP March 2007
2528 D> type=file;modify=19990419052351;perm=r;size=54264; URLMETHO.O
2529 D> type=file;modify=19980218161629;perm=r;size=993; WINDOWS.C
2530 D> type=file;modify=19970912154859;perm=r;size=146; WINDOWS.H
2531 D> type=file;modify=19990413153731;perm=r;size=16812; WINDOWS.O
2532 D> type=file;modify=19990322174959;perm=r;size=129; _CVSIGNO
2533 D> type=file;modify=19990413153640;perm=r;size=82536; _DEPEND
2534 S> 226 Transfer finished successfully.
2535 C> MLst src/install/windows.c
2536 S> 250-Listing src/install/windows.c
2537 S> type=file;perm=r;size=993; /misc/src/install/windows.c
2539 S> ftp> mlst SRC/INSTALL/WINDOWS.C
2540 C> MLst SRC/INSTALL/WINDOWS.C
2541 S> 250-Listing SRC/INSTALL/WINDOWS.C
2542 S> type=file;perm=r;size=993; /misc/SRC/INSTALL/WINDOWS.C
2545 Note that this server gives fully qualified pathnames for the "pdir"
2546 and "cdir" entries in MLSD listings. Also notice that this server
2547 does, though it is not required to, sort its directory listing
2548 outputs. That may be an artifact of the underlying file system
2549 access mechanisms of course. Finally notice that the NVFS supported
2550 by this server, in contrast to the earlier ones, implements its
2551 pathnames in a case independent manner. The server seems to return
2552 files using the case in which they were requested, when the name was
2553 sent by the client, and otherwise uses an algorithm known only to
2554 itself to select the case of the names it returns.
2556 7.7.10. A Server Listing Itself
2560 S> Type=dir;Modify=20000710052229;Unique=AAD/AAAABIA; f
2563 S> 250 CWD command successful.
2565 S> 150 Opening ASCII mode data connection for 'MLSD'.
2566 D> Type=cdir;Unique=AAD/AAAABIA; .
2567 D> Type=pdir;Unique=AAD/AAAAAAI; ..
2568 D> Type=file;Size=987;Unique=AAD/AAAABIE; Makefile
2569 D> Type=file;Size=20148;Unique=AAD/AAAABII; conf.c
2570 D> Type=file;Size=11111;Unique=AAD/AAAABIM; extern.h
2571 D> Type=file;Size=38721;Unique=AAD/AAAABIQ; ftpcmd.y
2572 D> Type=file;Size=17922;Unique=AAD/AAAABIU; ftpd.8
2573 D> Type=file;Size=60732;Unique=AAD/AAAABIY; ftpd.c
2574 D> Type=file;Size=3127;Unique=AAD/AAAABIc; logwtmp.c
2578 Hethmon Standards Track [Page 46]
2580 RFC 3659 Extensions to FTP March 2007
2583 D> Type=file;Size=2294;Unique=AAD/AAAABIg; pathnames.h
2584 D> Type=file;Size=7605;Unique=AAD/AAAABIk; popen.c
2585 D> Type=file;Size=9951;Unique=AAD/AAAABIo; ftpd.conf.5
2586 D> Type=file;Size=5023;Unique=AAD/AAAABIs; ftpusers.5
2587 D> Type=file;Size=3547;Unique=AAD/AAAABIw; logutmp.c
2588 D> Type=file;Size=2064;Unique=AAD/AAAABI0; version.h
2589 D> Type=file;Size=20420;Unique=AAD/AAAAAAM; cmds.c
2590 D> Type=file;Size=15864;Unique=AAD/AAAAAAg; ls.c
2591 D> Type=file;Size=2898;Unique=AAD/AAAAAAk; ls.h
2592 D> Type=file;Size=2769;Unique=AAD/AAAAAAo; lsextern.h
2593 D> Type=file;Size=2042;Unique=AAD/AAAAAAs; stat_flags.h
2594 D> Type=file;Size=5708;Unique=AAD/AAAAAAw; cmp.c
2595 D> Type=file;Size=9280;Unique=AAD/AAAAAA0; print.c
2596 D> Type=file;Size=4657;Unique=AAD/AAAAAA4; stat_flags.c
2597 D> Type=file;Size=2664;Unique=AAD/AAAAAA8; util.c
2598 D> Type=file;Size=10383;Unique=AAD/AAAABJ0; ftpd.conf.cat5
2599 D> Type=file;Size=3631;Unique=AAD/AAAABJ4; ftpusers.cat5
2600 D> Type=file;Size=17729;Unique=AAD/AAAABJ8; ftpd.cat8
2601 S> 226 MLSD complete.
2603 This examples shows yet another server implementation, showing a
2604 listing of its own source code. Note that this implementation does
2605 not include the fully qualified path name in its "cdir" and "pdir"
2606 entries, nor in the output from "MLST". Also note that the facts
2607 requested were modified between the "MLST" and "MLSD" commands,
2608 though that exchange has not been shown here.
2610 7.7.11. A Server with a Difference
2613 S> 227 Entering Passive Mode (127,0,0,1,255,46)
2615 S> 150 I tink I tee a trisector tree
2616 D> Type=file;Unique=aaaaafUYqaaa;Perm=rf;Size=15741; x
2617 D> Type=cdir;Unique=aaaaacUYqaaa;Perm=cpmel; /
2618 D> Type=file;Unique=aaaaajUYqaaa;Perm=rf;Size=5760; x4
2619 D> Type=dir;Unique=aaabcaUYqaaa;Perm=elf; sub
2620 D> Type=file;Unique=aaaaagUYqaaa;Perm=rf;Size=8043; x1
2621 D> Type=dir;Unique=aaab8aUYqaaa;Perm=cpmelf; files
2622 D> Type=file;Unique=aaaaahUYqaaa;Perm=rf;Size=4983; x2
2623 D> Type=file;Unique=aaaaaiUYqaaa;Perm=rf;Size=6854; x3
2624 S> 226 That's all folks...
2626 S> 250 CWD command successful.
2628 S> 257 "/sub" is current directory.
2630 S> 227 Entering Passive Mode (127,0,0,1,255,44)
2634 Hethmon Standards Track [Page 47]
2636 RFC 3659 Extensions to FTP March 2007
2640 S> 150 I tink I tee a trisector tree
2641 D> Type=dir;Unique=aaabceUYqaaa;Perm=elf; dir
2642 D> Type=file;Unique=aaabcbUYqaaa;Perm=rf;Size=0; y1
2643 D> Type=file;Unique=aaabccUYqaaa;Perm=rf;Size=0; y2
2644 D> Type=file;Unique=aaabcdUYqaaa;Perm=rf;Size=0; y3
2645 D> Type=pdir;Unique=aaaaacUYqaaa;Perm=cpmel; /
2646 D> Type=pdir;Unique=aaaaacUYqaaa;Perm=cpmel; ..
2647 D> Type=cdir;Unique=aaabcaUYqaaa;Perm=el; /sub
2648 S> 226 That's all folks...
2650 S> 227 Entering Passive Mode (127,0,0,1,255,42)
2652 S> 150 I tink I tee a trisector tree
2653 D> Type=pdir;Unique=aaabcaUYqaaa;Perm=el; /sub
2654 D> Type=pdir;Unique=aaabcaUYqaaa;Perm=el; ..
2655 D> Type=file;Unique=aaab8cUYqaaa;Perm=r;Size=15039; mlst.c
2656 D> Type=dir;Unique=aaabcfUYqaaa;Perm=el; ect
2657 D> Type=cdir;Unique=aaabceUYqaaa;Perm=el; dir
2658 D> Type=cdir;Unique=aaabceUYqaaa;Perm=el; /sub/dir
2659 D> Type=dir;Unique=aaabchUYqaaa;Perm=el; misc
2660 D> Type=file;Unique=aaab8bUYqaaa;Perm=r;Size=34589; ftpd.c
2661 S> 226 That's all folks...
2663 S> 250 CWD command successful.
2665 S> 257 "/sub/dir/ect" is current directory.
2667 S> 227 Entering Passive Mode (127,0,0,1,255,40)
2669 S> 150 I tink I tee a trisector tree
2670 D> Type=dir;Unique=aaabcgUYqaaa;Perm=el; ory
2671 D> Type=pdir;Unique=aaabceUYqaaa;Perm=el; /sub/dir
2672 D> Type=pdir;Unique=aaabceUYqaaa;Perm=el; ..
2673 D> Type=cdir;Unique=aaabcfUYqaaa;Perm=el; /sub/dir/ect
2674 S> 226 That's all folks...
2676 S> 250 CWD command successful.
2678 S> 227 Entering Passive Mode (127,0,0,1,255,36)
2680 S> 150 I tink I tee a trisector tree
2681 D> Type=cdir;Unique=aaab8aUYqaaa;Perm=cpmel; /files
2682 D> Type=pdir;Unique=aaaaacUYqaaa;Perm=cpmel; /
2683 D> Type=pdir;Unique=aaaaacUYqaaa;Perm=cpmel; ..
2684 D> Type=file;Unique=aaab8cUYqaaa;Perm=rf;Size=15039; mlst.c
2685 D> Type=file;Unique=aaab8bUYqaaa;Perm=rf;Size=34589; ftpd.c
2686 S> 226 That's all folks...
2690 Hethmon Standards Track [Page 48]
2692 RFC 3659 Extensions to FTP March 2007
2696 S> 350 File exists, ready for destination name
2698 S> 250 RNTO command successful.
2700 S> 227 Entering Passive Mode (127,0,0,1,255,34)
2702 S> 150 I tink I tee a trisector tree
2703 D> Type=file;Unique=aaab8cUYqaaa;Perm=rf;Size=15039; list.c
2704 D> Type=pdir;Unique=aaaaacUYqaaa;Perm=cpmel; /
2705 D> Type=pdir;Unique=aaaaacUYqaaa;Perm=cpmel; ..
2706 D> Type=file;Unique=aaab8bUYqaaa;Perm=rf;Size=34589; ftpd.c
2707 D> Type=cdir;Unique=aaab8aUYqaaa;Perm=cpmel; /files
2708 S> 226 That's all folks...
2710 The server shown here returns its directory listings in seemingly
2711 random order, and even seems to modify the order of the directory as
2712 its contents change -- perhaps the underlying directory structure is
2713 based upon hashing of some kind. Note that the "pdir" and "cdir"
2714 entries are interspersed with other entries in the directory. Note
2715 also that this server does not show a "pdir" entry when listing the
2716 contents of the root directory of the virtual filestore; however, it
2717 does however include multiple "cdir" and "pdir" entries when it feels
2718 inclined. The server also uses obnoxiously "cute" messages.
2720 7.8. FEAT Response for MLSx
2722 When responding to the FEAT command, a server-FTP process that
2723 supports MLST, and MLSD, plus internationalization of pathnames, MUST
2724 indicate that this support exists. It does this by including a MLST
2725 feature line. As well as indicating the basic support, the MLST
2726 feature line indicates which MLST facts are available from the
2727 server, and which of those will be returned if no subsequent "OPTS
2728 MLST" command is sent.
2730 mlst-feat = SP "MLST" [SP factlist] CRLF
2731 factlist = 1*( factname ["*"] ";" )
2733 The initial space shown in the mlst-feat response is that required by
2734 the FEAT command, two spaces are not permitted. If no factlist is
2735 given, then the server-FTP process is indicating that it supports
2736 MLST, but implements no facts. Only pathnames can be returned. This
2737 would be a minimal MLST implementation, and useless for most
2738 practical purposes. Where the factlist is present, the factnames
2739 included indicate the facts supported by the server. Where the
2740 optional asterisk appears after a factname, that fact will be
2741 included in MLST format responses, until an "OPTS MLST" is given to
2742 alter the list of facts returned. After that, subsequent FEAT
2746 Hethmon Standards Track [Page 49]
2748 RFC 3659 Extensions to FTP March 2007
2751 commands will return the asterisk to show the facts selected by the
2752 most recent "OPTS MLST".
2754 Note that there is no distinct FEAT output for MLSD. The presence of
2755 the MLST feature indicates that both MLST and MLSD are supported.
2760 S> 211- Features supported
2766 S> MLST Type*;Size*;Modify*;Perm*;Unique*;UNIX.mode;UNIX.chgd;X.hidden;
2769 Aside from some features irrelevant here, this server indicates that
2770 it supports MLST including several, but not all, standard facts, all
2771 of which it will send by default. It also supports two OS dependent
2772 facts, and one locally defined fact. The latter three must be
2773 requested expressly by the client for this server to supply them.
2776 S> 211-Extensions supported:
2779 S> MLST type*;size*;modify*;UNIX.mode*;UNIX.owner;UNIX.group;unique;
2784 S> Compliance Level: 19981201 (IETF mlst-05)
2787 Again, in addition to some irrelevant features here, this server
2788 indicates that it supports MLST, four of the standard facts, one of
2789 which ("unique") is not enabled by default, and several OS dependent
2790 facts, one of which is provided by the server by default. This
2791 server actually supported more OS dependent facts. Others were
2792 deleted for the purposes of this document to comply with document
2793 formatting restrictions.
2802 Hethmon Standards Track [Page 50]
2804 RFC 3659 Extensions to FTP March 2007
2808 S> 211-Features supported
2810 S> MLST Type*;Size*;Modify*;Perm;Unique*;
2816 This server has wisely chosen not to implement any OS dependent
2817 facts. At the time of writing this document, no such facts have been
2818 defined (using the mechanisms of section 10.1) so rational support
2819 for them would be difficult at best. All but one of the facts
2820 supported by this server are enabled by default.
2822 7.9. OPTS Parameters for MLST
2824 For the MLSx commands, the Client-FTP may specify a list of facts it
2825 wishes to be returned in all subsequent MLSx commands until another
2826 OPTS MLST command is sent. The format is specified by:
2828 mlst-opts = "OPTS" SP "MLST"
2829 [ SP 1*( factname ";" ) ]
2831 By sending the "OPTS MLST" command, the client requests the server to
2832 include only the facts listed as arguments to the command in
2833 subsequent output from MLSx commands. Facts not included in the
2834 "OPTS MLST" command MUST NOT be returned by the server. Facts that
2835 are included should be returned for each entry returned from the MLSx
2836 command where they meaningfully apply. Facts requested that are not
2837 supported, or that are inappropriate to the file or directory being
2838 listed should simply be omitted from the MLSx output. This is not an
2839 error. Note that where no factname arguments are present, the client
2840 is requesting that only the file names be returned. In this case,
2841 and in any other case where no facts are included in the result, the
2842 space that separates the fact names and their values from the file
2843 name is still required. That is, the first character of the output
2844 line will be a space, (or two characters will be spaces when the line
2845 is returned over the control connection) and the file name will start
2846 immediately thereafter.
2848 Clients should note that generating values for some facts can be
2849 possible, but very expensive, for some servers. It is generally
2850 acceptable to retrieve any of the facts that the server offers as its
2851 default set before any "OPTS MLST" command has been given, however
2852 clients should use particular caution before requesting any facts not
2853 in that set. That is, while other facts may be available from the
2854 server, clients should refrain from requesting such facts unless
2858 Hethmon Standards Track [Page 51]
2860 RFC 3659 Extensions to FTP March 2007
2863 there is a particular operational requirement for that particular
2864 information, which ought be more significant than perhaps simply
2865 improving the information displayed to an end user.
2867 Note, there is no "OPTS MLSD" command, the fact names set with the
2868 "OPTS MLST" command apply to both MLST and MLSD commands.
2870 Servers are not required to accept "OPTS MLST" commands before
2871 authentication of the user-PI, but may choose to permit them.
2873 7.9.1. OPTS MLST Response
2875 The "response-message" from [6] to a successful OPTS MLST command has
2876 the following syntax.
2878 mlst-opt-resp = "MLST OPTS" [ SP 1*( factname ";" ) ]
2880 This defines the "response-message" as used in the "opts-good"
2881 message in RFC 2389 [6].
2883 The facts named in the response are those that the server will now
2884 include in MLST (and MLSD) response, after the processing of the
2885 "OPTS MLST" command. Any facts from the request not supported by the
2886 server will be omitted from this response message. If no facts will
2887 be included, the list of facts will be empty. Note that the list of
2888 facts returned will be the same as those marked by a trailing
2889 asterisk ("*") in a subsequent FEAT command response. There is no
2890 requirement that the order of the facts returned be the same as that
2891 in which they were requested, or that in which they will be listed in
2892 a FEAT command response, or that in which facts are returned in MLST
2893 responses. The fixed string "MLST OPTS" in the response may be
2894 returned in any case, or mixture of cases.
2899 S> 211- Features supported
2900 S> MLST Type*;Size;Modify*;Perm;Unique;UNIX.mode;UNIX.chgd;X.hidden;
2902 C> OptS Mlst Type;UNIX.mode;Perm;
2903 S> 200 MLST OPTS Type;Perm;UNIX.mode;
2905 S> 211- Features supported
2906 S> MLST Type*;Size;Modify;Perm*;Unique;UNIX.mode*;UNIX.chgd;X.hidden;
2908 C> opts MLst lang;type;charset;create;
2909 S> 200 MLST OPTS Type;
2914 Hethmon Standards Track [Page 52]
2916 RFC 3659 Extensions to FTP March 2007
2919 S> 211- Features supported
2920 S> MLST Type*;Size;Modify;Perm;Unique;UNIX.mode;UNIX.chgd;X.hidden;
2922 C> OPTS mlst size;frogs;
2923 S> 200 MLST OPTS Size;
2925 S> 211- Features supported
2926 S> MLST Type;Size*;Modify;Perm;Unique;UNIX.mode;UNIX.chgd;X.hidden;
2928 C> opts MLst unique type;
2929 S> 501 Invalid MLST options
2931 S> 211- Features supported
2932 S> MLST Type;Size*;Modify;Perm;Unique;UNIX.mode;UNIX.chgd;X.hidden;
2935 For the purposes of this example, features other than MLST have been
2936 deleted from the output to avoid clutter. The example shows the
2937 initial default feature output for MLST. The facts requested are
2938 then changed by the client. The first change shows facts that are
2939 available from the server being selected. Subsequent FEAT output
2940 shows the altered features as being returned. The client then
2941 attempts to select some standard features that the server does not
2942 support. This is not an error, however the server simply ignores the
2943 requests for unsupported features, as the FEAT output that follows
2944 shows. Then, the client attempts to request a non-standard, and
2945 unsupported, feature. The server ignores that, and selects only the
2946 supported features requested. Lastly, the client sends a request
2947 containing a syntax error (spaces cannot appear in the factlist.)
2948 The server-FTP sends an error response and completely ignores the
2949 request, leaving the fact set selected as it had been previously.
2951 Note that in all cases, except the error response, the response lists
2952 the facts that have been selected.
2955 S> 211- Features supported
2956 S> MLST Type*;Size*;Modify*;Perm*;Unique*;UNIX.mode;UNIX.chgd;X.hidden;
2961 S> 211- Features supported
2962 S> MLST Type;Size;Modify;Perm;Unique;UNIX.mode;UNIX.chgd;X.hidden;
2970 Hethmon Standards Track [Page 53]
2972 RFC 3659 Extensions to FTP March 2007
2976 C> OPTS mlst unique;size;
2977 S> 200 MLST OPTS Size;Unique;
2980 S> Unique=keVO1+YZ5; /tmp
2982 C> OPTS mlst unique;type;modify;
2983 S> 200 MLST OPTS Type;Modify;Unique;
2986 S> Type=dir;Modify=19990930152225;Unique=keVO1+YZ5; /tmp
2988 C> OPTS mlst fish;cakes;
2994 C> OptS Mlst Modify;Unique;
2995 S> 200 MLST OPTS Modify;Unique;
2998 S> Modify=19990930152225;Unique=keVO1+YZ5; /tmp
3000 C> opts MLst fish cakes;
3001 S> 501 Invalid MLST options
3004 S> Modify=19990930152225;Unique=keVO1+YZ5; /tmp
3007 This example shows the effect of changing the facts requested upon
3008 subsequent MLST commands. Notice that a syntax error leaves the set
3009 of selected facts unchanged. Also notice exactly two spaces
3010 preceding the pathname when no facts were selected, either
3011 deliberately, or because none of the facts requested were available.
3013 8. Impact on Other FTP Commands
3015 Along with the introduction of MLST, traditional FTP commands must be
3016 extended to allow for the use of more than US-ASCII [1] or EBCDIC
3017 character sets. In general, the support of MLST requires support for
3018 arbitrary character sets wherever file names and directory names are
3019 allowed. This applies equally to both arguments given to the
3020 following commands and to the replies from them, as appropriate.
3026 Hethmon Standards Track [Page 54]
3028 RFC 3659 Extensions to FTP March 2007
3038 The arguments to all of these commands should be processed the same
3039 way that MLST commands and responses are processed with respect to
3040 handling embedded spaces, CRs and NULs. See section 2.2.
3042 9. Character Sets and Internationalization
3044 FTP commands are protocol elements, and are always expressed in
3045 ASCII. FTP responses are composed of the numeric code, which is a
3046 protocol element, and a message, which is often expected to convey
3047 information to the user. It is not expected that users normally
3048 interact directly with the protocol elements, rather the user-FTP
3049 process constructs the commands, and interprets the results, in the
3050 manner best suited for the particular user. Explanatory text in
3051 responses generally has no particular meaning to the protocol. The
3052 numeric codes provide all necessary information. Server-PIs are free
3053 to provide the text in any language that can be adequately
3054 represented in ASCII, or where an alternative language and
3055 representation has been negotiated (see [7]) in that language and
3058 Pathnames are expected to be encoded in UTF-8 allowing essentially
3059 any character to be represented in a pathname. Meaningful pathnames
3060 are defined by the server NVFS.
3062 No restrictions at all are placed upon the contents of files
3063 transferred using the FTP protocols. Unless the "media-type" fact is
3064 provided in a MLSx response nor is any advice given here that would
3065 allow determining the content type. That information is assumed to
3066 be obtained via other means.
3068 10. IANA Considerations
3070 This specification makes use of some lists of values currently
3071 maintained by the IANA, and creates two new lists for the IANA to
3072 maintain. It does not add any values to any existing registries.
3074 The existing IANA registries used by this specification are modified
3075 using mechanisms specified elsewhere.
3082 Hethmon Standards Track [Page 55]
3084 RFC 3659 Extensions to FTP March 2007
3087 10.1. The OS-Specific Fact Registry
3089 A registry of OS specific fact names shall be maintained by the IANA.
3090 The OS names for the OS portion of the fact name must be taken from
3091 the IANA's list of registered OS names. To add a fact name to this
3092 OS specific registry of OS specific facts, an applicant must send to
3093 the IANA a request, in which is specified the OS name, the OS
3094 specific fact name, a definition of the syntax of the fact value,
3095 which must conform to the syntax of a token as given in this
3096 document, and a specification of the semantics to be associated with
3097 the particular fact and its values. Upon receipt of such an
3098 application, and if the combination of OS name and OS specific fact
3099 name has not been previously defined, the IANA will add the
3100 specification to the registry.
3102 Any examples of OS specific facts found in this document are to be
3103 treated as examples of possible OS specific facts, and do not form a
3104 part of the IANA's registry merely because of being included in this
3107 10.2. The OS-Specific Filetype Registry
3109 A registry of OS specific file types shall be maintained by the IANA.
3110 The OS names for the OS portion of the fact name must be taken from
3111 the IANA's list of registered OS names. To add a file type to this
3112 OS specific registry of OS specific file types, an applicant must
3113 send to the IANA a request, in which is specified the OS name, the OS
3114 specific file type, a definition of the syntax of the fact value,
3115 which must conform to the syntax of a token as given in this
3116 document, and a specification of the semantics to be associated with
3117 the particular fact and its values. Upon receipt of such an
3118 application, and if the combination of OS name and OS specific file
3119 type has not been previously defined, the IANA will add the
3120 specification to the registry.
3122 Any examples of OS specific file types found in this document are to
3123 be treated as potential OS specific file types only, and do not form
3124 a part of the IANA's registry merely because of being included in
3138 Hethmon Standards Track [Page 56]
3140 RFC 3659 Extensions to FTP March 2007
3143 11. Security Considerations
3145 This memo does not directly concern security. It is not believed
3146 that any of the mechanisms documented here impact in any particular
3147 way upon the security of FTP.
3149 Implementing the SIZE command, and perhaps some of the facts of the
3150 MLSx commands, may impose a considerable load on the server, which
3151 could lead to denial of service attacks. Servers have, however,
3152 implemented this for many years, without significant reported
3155 The server-FTP should take care not to reveal sensitive information
3156 about files to unauthorised parties. In particular, some underlying
3157 filesystems provide a file identifier that, if known, can allow many
3158 of the filesystem protection mechanisms to be by-passed. That
3159 identifier would not be a suitable choice to use as the basis of the
3160 value of the unique fact.
3162 The FEAT and OPTS commands may be issued before the FTP
3163 authentication has occurred [6]. This allows unauthenticated clients
3164 to determine which of the features defined here are supported, and to
3165 negotiate the fact list for MLSx output. No actual MLSx commands may
3166 be issued however, and no problems with permitting the selection of
3167 the format prior to authentication are foreseen.
3169 A general discussion of issues related to the security of FTP can be
3194 Hethmon Standards Track [Page 57]
3196 RFC 3659 Extensions to FTP March 2007
3199 12. Normative References
3201 [1] Coded Character Set--7-bit American Standard Code for
3202 Information Interchange, ANSI X3.4-1986.
3204 [2] Yergeau, F., "UTF-8, a transformation format of ISO 10646", RFC
3205 3629, November 2003.
3207 [3] Postel, J. and J. Reynolds, "File Transfer Protocol (FTP)", STD
3208 9, RFC 959, October 1985.
3210 [4] Bradner, S., "Key words for use in RFCs to Indicate Requirement
3211 Levels", BCP 14, RFC 2119, March 1997.
3213 [5] Crocker, D. and P. Overell, "Augmented BNF for Syntax
3214 Specifications: ABNF", RFC 4234, October 2005.
3216 [6] Hethmon, P. and R. Elz, "Feature negotiation mechanism for the
3217 File Transfer Protocol", RFC 2389, August 1998.
3219 [7] Curtin, B., "Internationalization of the File Transfer
3220 Protocol", RFC 2640, July 1999.
3222 [8] Postel, J. and J. Reynolds, "Telnet protocol Specification", STD
3223 8, RFC 854, May 1983.
3225 [9] Braden, R,. "Requirements for Internet Hosts -- Application and
3226 Support", STD 3, RFC 1123, October 1989.
3228 [10] ISO/IEC 10646-1:1993 "Universal multiple-octet coded character
3229 set (UCS) -- Part 1: Architecture and basic multilingual plane",
3230 International Standard -- Information Technology, 1993.
3232 [11] Internet Assigned Numbers Authority. http://www.iana.org
3233 Email: iana@iana.org.
3235 [12] Phillips, A. and M. Davis, "Tags for Identifying Languages", BCP
3236 47, RFC 4646, September 2006.
3238 [13] Allman, M. and S. Ostermann, "FTP Security Considerations" RFC
3250 Hethmon Standards Track [Page 58]
3252 RFC 3659 Extensions to FTP March 2007
3257 This document is a product of the FTPEXT working group of the IETF.
3259 The following people are among those who have contributed to this
3266 Bill Fenner (and the rest of the IESG)
3267 Paul Ford-Hutchinson
3280 and the entire FTPEXT working group of the IETF.
3282 Apologies are offered to any inadvertently omitted.
3284 The description of the modifications to the REST command and the MDTM
3285 and SIZE commands comes from a set of modifications suggested for STD
3286 9, RFC 959 by Rick Adams in 1989. A document containing just those
3287 commands, edited by David Borman, has been merged with this document.
3289 Mike Gleason, Alun Jones and Luke Mewburn provided access to FTP
3290 servers used in some of the examples.
3292 All of the examples in this document are taken from actual
3293 client/server exchanges, though some have been edited for brevity, or
3294 to meet document formatting requirements.
3298 Several of the examples in this document exceed the RFC standard line
3299 length of 72 characters. Since this document is a standards-track
3300 result of an IETF working group and is important to an IETF sub-
3301 community, the RFC Editor is publishing it with the margin
3302 violations. This is not a precedent.
3306 Hethmon Standards Track [Page 59]
3308 RFC 3659 Extensions to FTP March 2007
3315 10420 Jackson Oaks Way, Suite 201
3318 EMail: phethmon@hethmon.com
3362 Hethmon Standards Track [Page 60]
3364 RFC 3659 Extensions to FTP March 2007
3367 Full Copyright Statement
3369 Copyright (C) The IETF Trust (2007).
3371 This document is subject to the rights, licenses and restrictions
3372 contained in BCP 78, and except as set forth therein, the authors
3373 retain all their rights.
3375 This document and the information contained herein are provided on an
3376 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
3377 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
3378 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
3379 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
3380 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
3381 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
3383 Intellectual Property
3385 The IETF takes no position regarding the validity or scope of any
3386 Intellectual Property Rights or other rights that might be claimed to
3387 pertain to the implementation or use of the technology described in
3388 this document or the extent to which any license under such rights
3389 might or might not be available; nor does it represent that it has
3390 made any independent effort to identify any such rights. Information
3391 on the procedures with respect to rights in RFC documents can be
3392 found in BCP 78 and BCP 79.
3394 Copies of IPR disclosures made to the IETF Secretariat and any
3395 assurances of licenses to be made available, or the result of an
3396 attempt made to obtain a general license or permission for the use of
3397 such proprietary rights by implementers or users of this
3398 specification can be obtained from the IETF on-line IPR repository at
3399 http://www.ietf.org/ipr.
3401 The IETF invites any interested party to bring to its attention any
3402 copyrights, patents or patent applications, or other proprietary
3403 rights that may cover technology that may be required to implement
3404 this standard. Please address the information to the IETF at
3409 Funding for the RFC Editor function is currently provided by the
3418 Hethmon Standards Track [Page 61]