SFTP Versions

Differences Between Versions

Initialisation
Property v3 v4 v5 v6 Notes
Extension data in SSH_FXP_INIT yes (4) no (4.1) no (4.1) no (4.1)  
Clients must support newline extension no yes (4.3) yes (4.3) yes (5.3)  
Server must send supported extension no no yes (4.4) no  
Server must send supported2 extension no no no yes (5.4)  
acl-supported extension no (5) no (5) no (5) yes (5.4)  
versions extension no no no yes (5.5) Client uses version-select extension
Default filename encoding unspecified UTF-8 (6.2) UTF-8 (6.2) UTF-8 (6)
filename-charset extension no no no yes (6)  
Attributes
Property v3 v4 v5 v6 Notes
Separate ACCESSTIME and MODIFYTIME no (5) yes (5.1) yes (5.1) yes (7.1) ACMODTIME clashes with ACCESSTIME
type byte no (5) yes (5.2) yes (5.2) yes (7.2) Always present (in v4 and beyond)
allocation-size no (5) no (5) no (5) yes (7.4) ALLOCATION_SIZE flag
string owner/group no (5) yes (5.4) yes (5.4) yes (7.5) UIDGID or OWNERGROUP flags
64-bit timestamps no (5) yes (5) yes (5) yes (7.7)  
nanosecond precision timestamps no (5) yes (5) yes (5) yes (7.7) SUBSECOND_TIMES flag
createtime field no (5) yes (5.6) yes (5.6) yes (7.7) CREATETIME flag
ctime field no (5) no (5) no (5) yes (7.7) CTIME flag
acl field no (5) yes (5.7) yes (5.7) yes (7.8) ACL flag. Format varies between versions.
attrib-bits field no (5) no (5) yes (5.8) yes (7.9) BITS flag
attrib-bits-valid field no (5) no (5) no (5.8) yes (7.9) BITS flag
SSH_FILEXFER_ATTR_FLAGS_TRANSLATION_ERR no (5) no (5) no (5.8) yes (7.9) Should imply UNTRANSLATED_NAME
text-hint field no (5) no (5) no (5) yes (7.10) TEXT_HINT flag
mime-type field no (5) no (5) no (5) yes (7.11) MIME_TYPE flag
link-count field no (5) no (5) no (5) yes (7.12) LINK_COUNT flag
untranslated-name field no (5) no (5) no (5) yes (7.13) UNTRANSLATED_NAME flag
Command Set
Property v3 v4 v5 v6 Notes
SSH_FXP_SYMLINK yes (6.10) yes (6.10) yes (6.9) no v3-v5 can make symlinks only
SSH_FXP_LINK no no no yes (8.7) v6 can make hard or symbolic links
SSH_FXP_BLOCK no no no yes (8.8.1)  
SSH_FXP_UNBLOCK no no no yes (8.8.2)  
Opening And Closing Files
Property v3 v4 v5 v6 Notes
SSH_FXP_OPEN pflags yes (6.3) yes (6.3) no no  
SSH_FXF_TEXT (or SSH_FXF_TEXT_MODE) no yes (6.3) yes (6.3.1) yes (8.1.1.3) Also text-seek extension
SSH_FXP_OPEN flags no no yes (6.3.1) yes (8.1.1.3) Similar role to pflags, different details
SSH_FXP_OPEN desired-access no no yes (6.3.1) yes (8.1.1.2)  
SSH_FXF_BLOCK_* no no no yes (8.1.1.3)  
SSH_FXF_NOFOLLOW no no no yes (8.1.1.3)  
SSH_FXF_DELETE_ON_CLOSE no no no yes (8.1.1.3)  
SSH_FXF_ACCESS_AUDIT_ALARM_INFO no no no yes (8.1.1.3)  
SSH_FXF_ACCESS_BACKUP no no no yes (8.1.1.3)  
SSH_FXF_BACKUP_STREAM no no no yes (8.1.1.3)  
SSH_FXF_OVERRIDE_OWNER no no no yes (8.1.1.3)  
Removing And Renaming Files
Property v3 v4 v5 v6 Notes
SSH_FXP_RENAME flags no (6.5) no (6.5) yes (6.5) yes (8.3) No overwriting rename in v3/v4
Retrieving File Attributes
Property v3 v4 v5 v6 Notes
SSH_FXP_*STAT flags no (6.8) yes (6.8) yes (6.7) yes (8.5)  
Canonicalizing the Server-Side Path Name
Property v3 v4 v5 v6 Notes
SSH_FXP_REALPATH control-byte no no no yes (8.9) Optional.
SSH_FXP_REALPATH compose-path no no no yes (8.9) Optional.
Responses from the Server to the Client
Property v3 v4 v5 v6 Notes
SSH_FXP_STATUS error-specific data no no yes (7) yes (9.1)  
SSH_FX_INVALID_HANDLE no yes (7) yes (7) yes (9.1)  
SSH_FX_NO_SUCH_PATH no yes (7) yes (7) yes (9.1)  
SSH_FX_FILE_ALREADY_EXISTS no yes (7) yes (7) yes (9.1)  
SSH_FX_WRITE_PROTECT no yes (7) yes (7) yes (9.1)  
SSH_FX_NO_MEDIA no yes (7) yes (7) yes (9.1)  
SSH_FX_NO_SPACE_ON_FILESYSTEM no no yes (7) yes (9.1)  
SSH_FX_QUOTA_EXCEEDED no no yes (7) yes (9.1)  
SSH_FX_UNKNOWN_PRINCIPAL no no yes (7) yes (9.1) Has error-specific data
SSH_FX_LOCK_CONFLICT no no yes (7) yes (9.1)  
SSH_FX_DIR_NOT_EMPTY no no no yes (9.1)  
SSH_FX_NOT_A_DIRECTORY no no no yes (9.1)  
SSH_FX_INVALID_FILENAME no no no yes (9.1)  
SSH_FX_LINK_LOOP no no no yes (9.1)  
SSH_FX_CANNOT_DELETE no no no yes (9.1)  
SSH_FX_INVALID_PARAMETER no no no yes (9.1)  
SSH_FX_FILE_IS_A_DIRECTORY no no no yes (9.1)  
SSH_FX_BYTE_RANGE_LOCK_CONFLICT no no no yes (9.1)  
SSH_FX_BYTE_RANGE_LOCK_REFUSED no no no yes (9.1)  
SSH_FX_DELETE_PENDING no no no yes (9.1)  
SSH_FX_FILE_CORRUPT no no no yes (9.1)  
SSH_FX_OWNER_INVALID no no no yes (9.1)  
SSH_FX_GROUP_INVALID no no no yes (9.1)  
SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK no no no yes (9.1)  
SSH_FXP_DATA end-of-file no no no yes (9.3) Optional.
SSH_FXP_NAME longname yes (7) no no no  
SSH_FXP_NAME end-of-list no no no yes (9.4)  
Property v3 v4 v5 v6 Notes

Summary Of Command Variations

Command v3 v4 v5 v6
SSH_FXP_INIT Extension data No extension data
SSH_FXP_OPEN pflags field flags field
SSH_FXP_CLOSE Same everywhere
SSH_FXP_READ max-read-size (8.2.1)
SSH_FXP_WRITE Same everywhere
SSH_FXP_LSTAT No flags flags field
SSH_FXP_FSTAT No flags flags field
SSH_FXP_SETSTAT Same everywhere
SSH_FXP_FSETSTAT Same everywhere
SSH_FXP_OPENDIR Same everywhere
SSH_FXP_READDIR Same everywhere
SSH_FXP_REMOVE Same everywhere
SSH_FXP_MKDIR Same everywhere
SSH_FXP_RMDIR Same everywhere
SSH_FXP_REALPATH Just path control-byte and compose-path
SSH_FXP_STAT No flags flags field
SSH_FXP_RENAME No flags flags
SSH_FXP_READLINK Same everywhere
SSH_FXP_SYMLINK Same absent
SSH_FXP_LINK absent Hard and soft links

Extensions

This section just lists all the extensions I know anything about, with information about their specifications (such as they are) where available. Just because an extension is listed here doens't mean it's a good idea to implement it.

supported2

Defined in draft-ietf-secsh-filexfer-13 s5.4. Describes general server capabilities. v6 servers MUST send this extension.

supported

Defined in draft-ietf-secsh-filexfer-05 s4.4. Describes general server capabilities. v5 servers MUST send this extension.

acl-supported

Defined in draft-ietf-secsh-filexfer-13 s5.4. Describes the server's support for ACLs.

text-seek

Defined in draft-ietf-secsh-filexfer-13 s8.1.1.3. Supports seeking by line number within text files. Servers at v4 and higher SHOULD support it but clients MUST cope without.

versions, version-select

Defined in draft-ietf-secsh-filexfer-13 s5.5. Used in v6 to allow more sophisticated version negotiation. If version-select is sent then it MUST be the first request (after SSH_FXP_INIT, presumably).

filename-charset, filename-translation-control

Defined in draft-ietf-secsh-filexfer-13 s6. filename-charset is optional and describes the likely encoding of untranslated names. filename-translation-control is mandatory if filename-charset was sent; it's used to suppress or re-enable filename translation.

newline

Described in draft-ietf-secsh-filexfer-13. Document's the newline sequence expxected by the server for text files. v4 clients and higher MUST support it.

vendor-id

Defined in draft-ietf-secsh-filexfer-09 and draft-ietf-secsh-filexfer-extensions-00. Implemented by (for instance) WinSCP.

md5-hash, md5-hash-handle

Described in draft-ietf-secsh-filexfer-09 s9.1.1 but not later versions (use check-file-handle and check-file-name instead). Computes the MD5 hash of a byte range of an open file.

check-file-handle, check-file-name

Described in draft-ietf-secsh-filexfer-09 s9.1.2 and draft-ietf-secsh-filexfer-extensions-00. Computes various kinds of checksum of a byte range of a file.

space-available

Described in draft-ietf-secsh-filexfer-09 s9.2 and draft-ietf-secsh-filexfer-extensions-00. Implemented by (for instance) WinSCP.

home-directory

Described in draft-ietf-secsh-filexfer-09 s9.3 and draft-ietf-secsh-filexfer-extensions-00.

copy-file and copy-data

Described in draft-ietf-secsh-filexfer-extensions-00.

get-temp-folder and make-temp-folder

Described in draft-ietf-secsh-filexfer-extensions-00.

owner-group-query@generic-extensions

Apparently reports a list of valid owner and group strings, which seems useful albeit potentially unbounded. Does not follow the rules for extension names (RFC4251 s6). Implemented by WinSCP. If you know where this is publicly documented, please let me know.

software@generic-extensions

Mentioned in the revision history of WinSCP. Does not follow the rules for extension names. I know nothing about it. If you know where this is publicly documented, please let me know.

fs-roots@vandyke.com

Apparently reports a list of available drives. Implemented WinSCP and I assume by the vandyke.com SFTP server. If you know where this is publicly documented, please let me know.

statfs@openssh.org

Exposes the UNIX statfs(2) system call via SFTP. Patch to OpenSSH (not applied at time of writing, link has bit-rotted).

posix-rename@openssh.org

Exposes the UNIX rename(2) system call via SFTP. Obsolete for protocol versions 5 and above but potentially useful for v3 and v4 which only have non-overwriting rename. Patch to OpenSSH (not applied at time of writing, link has bit-rotted).

symlink-order@rjk.greenend.org.uk and link-order@rjk.greenend.org.uk

Documents the order of the arguments to SSH_FXP_SYMLINK or SSH_FXP_LINK expected by the server (needed because some servers get it wrong). Specification.

posix-rename@openssh.com

Analogous to SSH_FXP_RENAME but uses the rename(2) syscall. PROTOCOL s3.3 describes. Implemented in OpenSSH since 2008.

statvfs@openssh.com

Retrieve information about a filesystem. PROTOCOL s3.4 describes. Implemented in OpenSSH since 2008.

fstatvfs@openssh.com

Retrieve information about a filesystem. PROTOCOL s3.4 describes. Implemented in OpenSSH since 2008.

hardlink@openssh.com

Create a hard link. PROTOCOL s10 describes. Implemented in OpenSSH since 2010.

Notes

Please let me know if there are important version differences I have missed, or an errors. I would particularly appreciate points to specifications for proposed or implement SFTP extensions.

I know that ACLs are not really well-treated here.

Where more than one draft gives a specification for a particular protocol version, I've chosen the latest one (see the links below); it is to these drafts that the section numbers refer. I've ignored versions before 3 completely.

At the time of writing there is no SFTP RFC.

Links

RJK | Contents