Archived Forum Post

Index of archived forum posts

Question:

SFTP upload fails

Jul 10 '12 at 19:06

Hi,

I've got a VB6 program that has been doing fine on a different server, but when I switch to another server (both internal to my company, in theory set up identically), I cannot upload. I can download and enumerate directory contents fine; it's just the upload that fails.

One thing I spotted in the .lasterrortext was this:

StatusResponse:
  Request: FXP_OPEN
  StatusCode: 5
  StatusMessage: Invalid file attributes specified

I don't see anything I can set that tells it to not request certain attributes to be set, or for that matter what attributes it might be asking for, so I'm not sure what it's trying to do. If I use WinSCP in GUI mode I can easily drag the same file across local -> remote and it doesn't complain so it doesn't seem to be permissions-related.

I appreciate any help!


Answer

Great, that (ForceV3) worked. It's a "newer" server so I suppose it was configured differently even though of course they swear it's identical...

Thanks so much for the responses and for a great product.


Answer

Please post the full contents of the LastErrorText. It is especially important to know if you are using an older version of the component, in which case it's best to first download and use the very latest version and then re-test.


Answer

Hi and thanks for the quick response. With personal stuff removed, here's the dump:

    UploadFileByName:
DllDate: May 25 2011
UnlockPrefix: [xxxx]
Username: [x:y]
Architecture: Little Endian; 32-bit
Language: ActiveX
SshVersion: SSH-2.0-0.0 
SftpVersion: 4
remoteFilename: [/path/path/path/filename]
localFilename: [filename]
ServerInitialWindowSize: 0
filename: [full-path-to-remote]
access: writeOnly
createDisposition: createTruncate
v3Flags: 0x1a
sendPacket:
  packetType: SSH_FXP_OPEN
  m_curServerWinSize: 32342
  sendMessage:
    msgName: CHANNEL_DATA
    unpaddedLength: 104
    remainder: 8
    paddingLen: 8
    totalSize: 112
Sent FXP_OPEN
readPacket2a:
  readPacket:
    loopIdx: 1
    readChannelData:
      clientChannelNum: 0
      totalTimeoutMs: 0
      bCheckQueue: 1
      bOnlyExtendedData: 0
      bSkipExtendedData: 1
      idleTimeoutMs_1: 0
      calledFrom: 103
      bReadOneRaw: 0
    Decrypting first block of message..
    packetLen: 76
    mType: CHANNEL_DATA
    payloadMsgType: 94
    payloadLen: 66
    payload: 5E00 0000 0000 0000 3900 0000 3565 0000
    0048 0000 0005 0000 0022 496E 7661 6C69
    6420 6669 6C65 2061 7474 7269 6275 7465
    7320 7370 6563 6966 6965 6420 0000 0002
    656E 
    Received partial packet...
    length: 53
    dbMsgLen: 57
  packetType: SSH_FXP_STATUS
StatusResponse:
  Request: FXP_OPEN
  StatusCode: 5
  StatusMessage: Invalid file attributes specified 
SshLog: 
    SFTP> Sending SSH_FXP_OPEN
    TRAN> CHANNEL_DATA
    TRAN* NumBytes: 90
    TRAN* Packet start: 00 00 00 4c 09 5e 00 00 00 00 00 00 00 39 00 00 
    TRAN* packetLen: 76
    TRAN< CHANNEL_DATA
    TRAN* payload size: 66
    SFTP< Received SSH_FXP_STATUS
timeToOpenMs: Elapsed time: 125 millisec
Failed to open file.
ResumeInfo: Cannot resume
totalTimeMs: Elapsed time: 125 millisec
Failed.

Answer

Okay, downloaded the most current on the site, and here's the only difference between the above and the new log (new <!, old !>). Still same net failure.

 <!     DllDate: Jan 19 2012
 !>     DllDate: May 25 2011
 <!     ServerInitialWindowSize: 2147483647
 !>     ServerInitialWindowSize: 0
 <!       m_curServerWinSize: 0x80007ef4
 !>       m_curServerWinSize: 32342
 <!       --sendMessage
 <!     --sendPacket
 !>     readPacket2a:
 !>       readPacket:
 <!     --readChannelData
 <! 000B 0000 0005 0000 0022 496E 7661 6C69
 !> 0048 0000 0005 0000 0022 496E 7661 6C69
 !>         Received partial packet...
 !>         length: 53
 !>         dbMsgLen: 57
 <!     --StatusResponse
 <!     timeToOpenMs: Elapsed time: 141 millisec
 !>     timeToOpenMs: Elapsed time: 125 millisec
 <!     totalTimeMs: Elapsed time: 141 millisec
 !>     totalTimeMs: Elapsed time: 125 millisec
 <!   --UploadFileByName
 <! --ChilkatLog

Answer

Hi again,

Anything further I can try to determine what the module is complaining about? I've got verbose on but perhaps there's a "more verbose" mode that would explain more?


Answer

You're still using an older version. The latest version is from April 2012. Your LastErrorText shows this:

DllDate: Jan 19 2012


Answer

Bizarre. I installed that last Thursday and can't think where I would have downloaded from but your site. I note that the current one has the version number in the name of the .msi, which the one I installed last week didn't. No matter, I just installed this one and still having the same error result. Here's the whole log this time:

ChilkatLog:
  UploadFileByName:
    DllDate: Apr 17 2012
    UnlockPrefix: [xxxx]
    Username: [x:y]
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    SshVersion: SSH-2.0-0.0 
    SftpVersion: 4
    remoteFilepath: [/path/path/path/filename]
    localFilepath: [filename]
    ServerInitialWindowSize: 2147483647
    filename: [/path/path/path/filename]
    access: writeOnly
    createDisposition: createTruncate
    v3Flags: 0x1a
    sendPacket:
      packetType: SSH_FXP_OPEN
      sendMessage:
        msgName: CHANNEL_DATA
        unpaddedLength: 120
        remainder: 8
        paddingLen: 8
        totalSize: 128
      --sendMessage
    --sendPacket
    Sent FXP_OPEN
    loopIdx: 1
    readChannelData_2:
      readChannelData:
        clientChannelNum: 0
        totalTimeoutMs: 0
        bCheckQueue: 1
        bOnlyExtendedData: 0
        bSkipExtendedData: 1
        idleTimeoutMs_1: 0
        calledFrom: 103
        bReadOneRaw: 0
      --readChannelData
      genRead_1:
        Decrypting first block of message..
        packetLen: 76
        mType: CHANNEL_DATA
        payloadMsgType: 94
        payloadLen: 66
        payload: 5E00 0000 0000 0000 3900 0000 3565 0000
0001 0000 0005 0000 0022 496E 7661 6C69
6420 6669 6C65 2061 7474 7269 6275 7465
7320 7370 6563 6966 6965 6420 0000 0002
656E
      --genRead_1
    --readChannelData_2
    packetType: SSH_FXP_STATUS
    StatusResponseFromServer:
      Request: FXP_OPEN
      InformationReceivedFromServer:
        StatusCode: 5
        StatusMessage: Invalid file attributes specified 
      --InformationReceivedFromServer
    --StatusResponseFromServer
    SshLog: 
SFTP> Sending SSH_FXP_OPEN
TRAN> CHANNEL_DATA
TRAN* NumBytes: 106
TRAN* Packet start: 00 00 00 4c 09 5e 00 00 00 00 00 00 00 39 00 00 
TRAN* packetLen: 76
TRAN< CHANNEL_DATA
TRAN* payload size: 66
SFTP< Received SSH_FXP_STATUS

    timeToOpenMs: Elapsed time: 141 millisec
    Failed to open file.
    ResumeInfo: Cannot resume
    totalTimeMs: Elapsed time: 141 millisec
    Failed.
  --UploadFileByName
--ChilkatLog

Answer

I see that the SSH client and server decided to use v4 of the SFTP protocol. Check to see if using v3 of the SFTP protocol solves the problem. Do this by setting the sftp.ForceV3 property = 1 (Given that you are using the ActiveX, boolean properties are actually integers having the value 1 or 0)

If that doesn't work, then for testing purposes, try calling the sftp.OpenFile method with the access argument equal to "readWrite", and the createDisposition argument equal to "createTruncate".