0 votes
by (180 points)
edited

We have implemented an SFTP client that works fine in the lab but is failing at a customer site with a Rebex.Net.SftpException: No such file; No such file. The PutFile statement is quite simple:

BytesTransferred = Ftp.PutFile(FilesToTransfer[FileNo], RemotePath + Path.GetFileName(FilesToTransfer[FileNo]));

The logging shows:

2014-30-04 12:43:45.388 Opening log file.
2014-30-04 12:43:45.388 INFO Sftp(1) Info: Connecting to 10.33.255.17:22 using Sftp 2.0.3333.0.
2014-30-04 12:43:45.607 DEBUG Sftp(1) SSH: Server is 'SSH-2.0-OpenSSH_5.0'.
2014-30-04 12:43:46.076 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_KEXINIT (735 bytes).
2014-30-04 12:43:46.076 DEBUG Sftp(1) SSH: Negotiation started.
2014-30-04 12:43:46.076 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_KEXINIT (504 bytes).
2014-30-04 12:43:46.091 DEBUG Sftp(1) SSH: Group exchange.
2014-30-04 12:43:46.091 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_KEXDH_INIT (16 bytes).
2014-30-04 12:43:46.435 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_KEX_DH_GEX_GROUP (139 bytes).
2014-30-04 12:43:46.435 DEBUG Sftp(1) SSH: Negotiating key.
2014-30-04 12:43:46.466 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_KEX_DH_GEX_INIT (144 bytes).
2014-30-04 12:43:46.560 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_KEX_DH_GEX_REPLY (629 bytes).
2014-30-04 12:43:46.591 DEBUG Sftp(1) SSH: Validating signature.
2014-30-04 12:43:46.607 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_NEWKEYS (16 bytes).
2014-30-04 12:43:46.607 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_NEWKEYS (1 bytes).
2014-30-04 12:43:46.607 DEBUG Sftp(1) SSH: Negotiation finished.
2014-30-04 12:43:46.607 INFO Sftp(1) Info: Server: SSH-2.0-OpenSSH_5.0
2014-30-04 12:43:46.607 INFO Sftp(1) Info: Fingerprint: 62:57:19:a0:78:05:8a:c0:1f:bc:df:24:fa:24:68:5f
2014-30-04 12:43:46.607 INFO Sftp(1) Info: Cipher info: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS, 256bit AES/256bit AES, SHA1/SHA1
2014-30-04 12:43:46.623 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_SERVICE_REQUEST (52 bytes).
2014-30-04 12:43:46.920 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_SERVICE_ACCEPT (17 bytes).
2014-30-04 12:43:46.920 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_USERAUTH_REQUEST (68 bytes).
2014-30-04 12:43:46.998 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_USERAUTH_FAILURE (24 bytes).
2014-30-04 12:43:46.998 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_USERAUTH_REQUEST (100 bytes).
2014-30-04 12:43:47.045 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_USERAUTH_SUCCESS (1 bytes).
2014-30-04 12:43:47.045 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_CHANNEL_OPEN (68 bytes).
2014-30-04 12:43:47.482 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_CHANNEL_OPEN_CONFIRMATION (17 bytes).
2014-30-04 12:43:47.482 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_CHANNEL_REQUEST (68 bytes).
2014-30-04 12:43:47.545 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_CHANNEL_WINDOW_ADJUST (9 bytes).
2014-30-04 12:43:47.545 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_CHANNEL_SUCCESS (5 bytes).
2014-30-04 12:43:47.545 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_CHANNEL_DATA (52 bytes).
2014-30-04 12:43:47.545 INFO Sftp(1) Command: SSH_FXP_INIT (3)
2014-30-04 12:43:47.638 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_CHANNEL_DATA (82 bytes).
2014-30-04 12:43:47.638 INFO Sftp(1) Response: SSH_FXP_VERSION (3, 2 extensions)
2014-30-04 12:43:47.638 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_CHANNEL_DATA (52 bytes).
2014-30-04 12:43:47.638 INFO Sftp(1) Command: SSH_FXP_REALPATH (1, '.')
2014-30-04 12:43:47.701 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_CHANNEL_DATA (54 bytes).
2014-30-04 12:43:47.701 INFO Sftp(1) Response: SSH_FXP_NAME (1, 1 item)
2014-30-04 12:43:47.701 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_CHANNEL_DATA (52 bytes).
2014-30-04 12:43:47.701 INFO Sftp(1) Command: SSH_FXP_STAT (2, '/')
2014-30-04 12:43:47.779 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_CHANNEL_DATA (50 bytes).
2014-30-04 12:43:47.779 INFO Sftp(1) Response: SSH_FXP_ATTRS (2)
2014-30-04 12:43:47.779 VERBOSE Sftp(1) SSH: Sending packet SSH_MSG_CHANNEL_DATA (84 bytes).
2014-30-04 12:43:47.779 INFO Sftp(1) Command: SSH_FXP_OPEN (3, '/T0906597.T', 26)
2014-30-04 12:43:47.826 VERBOSE Sftp(1) SSH: Received packet SSH_MSG_CHANNEL_DATA (42 bytes).
2014-30-04 12:43:47.826 INFO Sftp(1) Response: SSH_FXP_STATUS (3, 2, 'No such file')
2014-30-04 12:43:47.841 ERROR Sftp(1) Info: Rebex.Net.SftpException: No such file; No such file.
   at Rebex.Net.SftpCore.ThrowOnError(Packet packet, Type expected)
   at Rebex.Net.SftpCore.Open(String path, SftpOpenMode mode, Boolean failOnError)
   at Rebex.Net.Sftp.PutFileInternal(SftpOpenMode mode, Object state, String remotePath, Stream sourceStream, Int64 remoteOffset, Int64 length)

Any advice?

David

2 Answers

0 votes
by (58.9k points)
edited

Thank you for the log file. This is strange as when we request the remote file to be created, server really replies with the "No such file" error response as can be seen in the log file.

Would it be possible to download the free PSFTP utility, test whether the PSFTP is able to upload the 'T0906597.T' file and let us know the result?

+1 vote
by (180 points)
edited

We changed the code to specify the file name as T0906597.T rather than as /T0906597.T and the error went away.

A server specific foible, I suppose.

Thanks for the offer of help anyway.

D

by (58.9k points)
edited

I am glad it works for you now. Thanks for letting us know.

...