The protocol used by sftp isn't actually an IETF standard. OpenSSH (and SunSSH) uses this document:http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02
[This is actually protocol version 3]
In that version of the draft there was a 'longname' field in the SSH_FXP_NAME response. The standard explicitly says:
The SSH_FXP_NAME response has the following format:
repeats count times:
The format of the `longname' field is unspecified by this protocol.
It MUST be suitable for use in the output of a directory listing
command (in fact, the recommended operation for a directory listing
command is to simply display this data). However, clients SHOULD NOT
attempt to parse the longname field for file attributes; they SHOULD
use the attrs field instead.
When you do 'ls -l' the sftp client is displaying longname so it is the server
that created that. The longname is generated on the server and looks like the output of 'ls -l', the uid/gid to username/groupname translation was done on the server side.
When you add in '-h' the sftp client is obeying the draft standard and not parsing the longname field because it has to pretty print the size into SI units. So it must just display the uid/gid.
The OpenSSH code explicitly does not attempt to translate the uid/gid because it has no way of knowing if the nameservice domain on the remote and local sides is the same. This is why when you do 'lls -lh' you do get SI units and translated names but when you do 'ls -l' you get untranslated names.
In the very next version of the draft:https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-03.txt
[ Protocol version 4]
The format of SSH_FXP_NAME and importantly ATTRS changes very significantly. The longname is dropped and the ATTRS no longer has a UNIX uid/gid but an NFSv4 owner/group.
OpenSSH never implemented anything past the -02 draft. Attempts at standardising the SFTP protocol eventually stopped at the -13 draft (which was protocol version 6) in 2006.
The proftpd server also has the ability to do the sftp protocol and it implements the -13 draft. However Solaris 11 doesn't currently ship with the mod_sftp module, and even if it did the /usr/bin/sftp client doesn't talk that protocol version so an alternate client would be needed too.
I had some one recently question why with OpenSSH using sftp(1) when the do 'ls -l' the get username/groupname in the output but when the do 'ls -lh' the file sizes are translated into SI units but the output now shows the uid/gid. It took myself and another engineer a while to work through this so I thought I would blog the explanation for what is going on.