0 votes
by (150 points)
edited by

Hi I am trying to connect to a particular clients FTP site via our app that uses Rebex. I can connect to the same site and read their directory with both FileZilla and WinSCP.

I can connect and login but whenever I attempt to change directory or confirm the existence of the directory I get a failure. The debug messages are not very helpful as I am getting the generic SSH_FXP_STATUS 4 error with no message. The logs are from a quick console app I made to test so as to make sure there wasn't something else in the actual app that was causing an issue but the result is exactly the same. Any ideas?

2019-10-28 12:01:02.483 Opening log file.
2019-10-28 12:01:02.494 INFO FileLogWriter(1)[1] Info: Assembly: Rebex.Common 2019 R3.2 for .NET Standard 2.0
2019-10-28 12:01:02.524 INFO FileLogWriter(1)[1] Info: Platform: Windows 10.0.18362 64-bit; CLR: .NET Core 3.0.0
2019-10-28 12:01:02.530 DEBUG FileLogWriter(1)[1] Info: Culture: en; windows-1252
2019-10-28 12:01:02.694 INFO Sftp(1)[4] Info: Connecting to xxx.xxx.xx.xx:22 using Sftp.
2019-10-28 12:01:02.694 INFO Sftp(1)[4] Info: Assembly: Rebex.Sftp 2019 R3.2 for .NET Standard 2.0 (Trial)
2019-10-28 12:01:02.694 INFO Sftp(1)[4] Info: Platform: Windows 10.0.18362 64-bit; CLR: .NET Core 3.0.0
2019-10-28 12:01:02.694 DEBUG Sftp(1)[4] Info: Culture: en; windows-1252
2019-10-28 12:01:02.710 DEBUG Sftp(1)[4] Proxy: Connecting to xxx.xxx.xx.xx:22 (no proxy).
2019-10-28 12:01:03.616 DEBUG Sftp(1)[4] SSH: Server is 'SSH-2.0-DataPowerSSH_1.1'.
2019-10-28 12:01:03.637 INFO Sftp(1)[4] SSH: Negotiation started.
2019-10-28 12:01:03.767 DEBUG Sftp(1)[4] SSH: Group exchange.
2019-10-28 12:01:03.791 DEBUG Sftp(1)[4] SSH: Negotiating key.
2019-10-28 12:01:03.806 DEBUG Sftp(1)[4] SSH: Received 2048-bit Diffie-Hellman prime (minimum allowed size is 1024 bits).
2019-10-28 12:01:03.846 DEBUG Sftp(1)[4] SSH: Validating signature.
2019-10-28 12:01:03.898 DEBUG Sftp(1)[4] SSH: Received 1024-bit RSA server key (minimum allowed size is 1023 bits).
2019-10-28 12:01:03.913 INFO Sftp(1)[4] SSH: Negotiation finished.
2019-10-28 12:01:03.913 INFO Sftp(1)[4] Info: Server: SSH-2.0-DataPowerSSH_1.1
2019-10-28 12:01:03.914 INFO Sftp(1)[4] Info: Fingerprint (MD5): 2b:53:f8:ac:06:59:c1:4e:ba:8d:79:a6:3a:1a:b3:87
2019-10-28 12:01:03.914 INFO Sftp(1)[4] Info: Fingerprint (SHA-256): D4zf1g8r5Nfafo33PnX4fLRLzyhyxkIF6C9WaiBCy+Y
2019-10-28 12:01:03.915 INFO Sftp(1)[4] Info: Cipher info: SSH 2.0, diffie-hellman-group-exchange-sha256, ssh-rsa, aes256-gcm@openssh.com/aes256-gcm@openssh.com
2019-10-28 12:01:03.991 DEBUG Sftp(1)[5] SSH: Allowed authentication methods for 'USERNAME': password.
2019-10-28 12:01:03.992 DEBUG Sftp(1)[5] SSH: Trying password authentication for 'USERNAME'.
2019-10-28 12:01:04.063 DEBUG Sftp(1)[5] SSH: Authentication successful.
2019-10-28 12:01:04.067 DEBUG Sftp(1)[5] SSH: Opening channel 'session' (initial window size: 131072, max packet size: 129024).
2019-10-28 12:01:04.154 DEBUG Sftp(1)[5] SSH: Requesting subsystem 'sftp'.
2019-10-28 12:01:04.177 DEBUG Sftp(1)[6] SSH: Adjusted remote window size: 0 -> 2097152.
2019-10-28 12:01:04.186 INFO Sftp(1)[5] Command: SSH_FXP_INIT (4)
2019-10-28 12:01:04.209 INFO Sftp(1)[5] Response: SSH_FXP_VERSION (3, 0 extensions)
2019-10-28 12:01:04.210 INFO Sftp(1)[5] Info: Using SFTP v3.
2019-10-28 12:01:04.219 INFO Sftp(1)[5] Command: SSH_FXP_REALPATH (1, '.')
2019-10-28 12:01:04.243 INFO Sftp(1)[5] Response: SSH_FXP_NAME (1, 'HOMEDIRECTORY')
2019-10-28 12:01:04.243 INFO Sftp(1)[5] Info: Home directory is 'GETSHOMEDIRECTORY'.
2019-10-28 12:01:04.253 INFO Sftp(1)[7] Command: SSH_FXP_STAT (2, 'HOMEDIRECTORY/DIRECTORYIWANTTOREAD')
2019-10-28 12:01:05.275 INFO Sftp(1)[7] Response: SSH_FXP_STATUS (2, 4, '')
2019-10-28 12:01:05.360 ERROR Sftp(1)[7] Info: Rebex.Net.SftpException: Failure.
   at ayny.mpbh(dyqy are, Type arf)
   at ayny.mpas(String api, Boolean apj, Boolean apk, Boolean apl, aynz apm, ayoe& apn, ayni apo)
   at Rebex.Net.Sftp.dnoy(String uf, Boolean ug, Boolean uh, Boolean ui, ayni uj)
Applies to: Rebex SFTP
by (120 points)
I am experiencing the same problem with the same ftp server
do we have a solution for it? probably there is a flag that should be explicitely set?
by (150 points)
We contacted Rebex directly and Lukas provided us with a new DLL to try which handles DirectoryExists/ChangeDirectory differently. As it happened a non-technical  work around was found for our situation so I never tried it.
by (148k points)
I posted a link to a hotfix build that attempts to work around this issue here: https://forum.rebex.net/11437/sftp-cant-connect-to-datapower-server?show=11439#a11439

1 Answer

0 votes
by (148k points)

Rebex SFTP issues SSH_FXP_STAT command to determine whether the specified directory exists, and this action is also done when changing the current directory. Unfortunately, it seems that your SFTP server is unable to handle SSH_FXP_STAT commands properly.

Are you able to list the directory and download/upload files by specifying their whole paths instead of changing the directory first? That might be a suitable workaround.

...