EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTP Download yields Couldn't stat remote file

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
Posted: 03/25/2015 13:42:58
by Rafael Hernandez (Standard support level)
Joined: 02/04/2015
Posts: 21

I am currently evaluating the SFTP portion of SecureBlackbox (Java Version) and currently have my own working version of the sample Sftp Server. I can successfully upload only certain types of files like text and UTF-8 at the moment but when I try to re-download them I get the following error:
Couldn't stat remote file: No such file or directory
I am using SSH-2.0-OpenSSH_6.7 and Transmit as the clients. This issue does not occur in FileZilla as I am able to read the files just fine. Also, I have tried setting all the READ, WRITE, EXECUTE permissions of TElSftpFileAttributes to true to see if that helped any but no luck.

Please provide guidance on how I may resolve this issue. Thanks.
Posted: 03/25/2015 13:52:59
by Eugene Mayevski (Team)

Does the file actually exist (i.e. is it created after upload) on your server?

In general, the file operations are handled via event handlers in your code (or in sample code). You can put a breakpoint in the event handler for OnOpenFile event and see if it's reached when you try to download the file, and if it is, what's going on in the event handler (is the correct path specified, is the file opened etc).

Sincerely yours
Eugene Mayevski
Posted: 03/25/2015 17:01:08
by Rafael Hernandez (Standard support level)
Joined: 02/04/2015
Posts: 21

The file is never written to disk. It is intentionally virtual and is kept only in memory. The request never makes it to TElSFTPServerOpenFileEvent. However, I do see that TSSHReceiveEvent gets hit twice and TSSHSendEvent gets hit once before I see the message outputted on my OpenSSH client.
Posted: 03/26/2015 03:36:23
by Vsevolod Ievgiienko (Team)

I recommend you to check our SFTP server sample without any modifications as I also suggested in this topic: https://www.eldos.com/forum/read.php?F...ssage32775

This way it will be easier to localize the problem if the reason is in our code.
Posted: 03/26/2015 12:18:30
by Rafael Hernandez (Standard support level)
Joined: 02/04/2015
Posts: 21

Utilizing the latest SFTP Server sample (writes to disk) out-of-the-box, I have no issues with retrieval of a file. How can I achieve the same result when files are never written disk? This is our use-case and writing to disk for us is not an option. Please advise on the next steps. Thanks.
Posted: 03/26/2015 13:19:10
by Eugene Mayevski (Team)

The fact that the unmodified server works means that the problem originates from your code which handles events. Most likely directory listing event handler needs correction. Unfortunately that's all we can say without debugging your code.

Sincerely yours
Eugene Mayevski
Posted: 03/26/2015 16:01:26
by Rafael Hernandez (Standard support level)
Joined: 02/04/2015
Posts: 21

Understood. Can you please tell me when settingTElSftpFileAttributes, which FileType is recommended when dealing with virtual directories and files which are never written to disk? Thanks.
Posted: 03/27/2015 02:08:39
by Rafael Hernandez (Standard support level)
Joined: 02/04/2015
Posts: 21

For the benefit of anyone who may need it in the future. Indeed it was a logic error in TElSFTPServerRequestAttributesEvent. Once I fixed the logic, I was able to download some files successfully. Other files failed to download with the following error:
Corrupted MAC on input.
Disconnecting: Packet corrupt

The cause of this error is something else and I believe it may be associated to issue #32766 .

Thanks for all the great help on this one.
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.



Topic viewed 2021 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!