SSH FTP file attributes
The same encoding is used both when sending and returning file attributes from the server. When sending it to the server, the flags field specifies which attributes are included, and the server will use default values for the remaining attributes or will not modify the values of remaining attributes. When receiving attributes from the server, the flags specify which attributes are included in the returned data. The server normally returns all attributes known to it.
uint32 | flags | |
uint64 | size | present only if flag SSH_FILEXFER_ATTR_SIZE |
uint32 | uid | present only if flag SSH_FILEXFER_ATTR_UIDGID |
uint32 | gid | present only if flag SSH_FILEXFER_ATTR_UIDGID |
uint32 | permissions | present only if flag SSH_FILEXFER_ATTR_PERMISSIONS |
uint32 | atime | present only if flag SSH_FILEXFER_ACMODTIME |
uint32 | mtime | present only if flag SSH_FILEXFER_ACMODTIME |
uint32 | extended_count | present only if flag SSH_FILEXFER_ATTR_EXTENDED |
string | extended_type | |
string | extended_data | ...more extended data (extended_type - extended_data pairs), so that number of pairs equals extended_count |
- Flags specify which of the fields are present. Those fields for which the corresponding flag is not set are not present and not included in the packet.
- The size field specifies the size of the file in bytes.
- The uid and gid fields contain numeric Unix-like user and group identifiers, respectively. The server only supports these fields on Unix systems.
- The permissions field contains a bit mask of file permissions as defined by posix. For non-Unix systems only the owner permissions are supported by the server.
- The atime and mtime contain the access and modification times of the files, respectively. They are represented as seconds from Jan 1, 1970 in UTC.
- The SSH_FILEXFER_ATTR_EXTENDED flag provides a general extension mechanism for vendor-specific extensions. This flag is not used by the server.
The flags bits are defined to have the following values:
SSH_FILEXFER_ATTR_SIZE | 0x00000001 |
SSH_FILEXFER_ATTR_UIDGID | 0x00000002 |
SSH_FILEXFER_ATTR_PERMISSIONS | 0x00000004 |
SSH_FILEXFER_ATTR_ACMODTIME | 0x00000008 |
SSH_FILEXFER_ATTR_EXTENDED | 0x80000000 |