SFTP Server Error Messages – sometimes obscure and misleading

Two recent customer support issues prompted this post.  In both cases, the error reported by the SFTP server was both lacking in information as well as somewhat misleading.  One brand of server was:

SSH-2.0-http://www.sshtools.com J2SSH [SERVER]

The other was:

SSH-2.0-WS_FTP-SSH_7.1

With the 1st SSH server, the following error occurred when trying to open a file:

     OpenFile:
        DllDate: Jun 10 2009
        UnlockPrefix: ****
        Username: ****
        Component: .NET 2.0
        SshVersion: SSH-2.0-http://www.sshtools.com J2SSH [SERVER]
        SftpVersion: 3
        filename: ****
        access: writeOnly
        createDisposition: openOrCreate
        v3Flags: 0xa
        Sent FXP_OPEN
        StatusCode: 4
        StatusMessage: Denied!
        SshLog:
    SFTP> Sending SSH_FXP_OPEN
    TRAN> CHANNEL_DATA
    TRAN* NumBytes: 76
    TRAN< CHANNEL_DATA
    SFTP< Received SSH_FXP_STATUS

        Failed. 

The server simply responds with an error message “Denied!”. The customer found the solution: Thanks Matt it turns out I forgot to prefix the filename with a “/”.

With the 2nd SSH server, the Chilkat customer reported this error when trying to upload a file to the SSH server:

 UploadFileByName:
    DllDate: Jun 23 2009
    UnlockPrefix: Anything for 30-day trial
    Username: ***
    Component: .NET 2.0
    SshVersion: SSH-2.0-WS_FTP-SSH_7.1
    SftpVersion: 4
    remoteFilename: ***.txt
    localFilename: ***.txt
    hcCurDate: Wed, 05 Aug 2009 14:43:36 -0500
    hcExpire: 8/2009
    filename: ***.txt
    access: writeOnly
    createDisposition: createTruncate
    v3Flags: 0x1a
    Sent FXP_OPEN
    StatusCode: 4
    StatusMessage: Folder not found: ***.txt
    SshLog: 
SFTP> Sending SSH_FXP_OPEN
TRAN> CHANNEL_DATA
TRAN* NumBytes: 58
TRAN< CHANNEL_DATA
SFTP< Received SSH_FXP_STATUS

    Failed.

The server responds with the error “Folder not found”. The Chilkat customer found the solution:
Yes thanks for the tip. I had to get real path and then add a / then file name. I thought I would let you know for future reference.