Archived Forum PostQuestion:
I'm trying to "DownloadFileByName" via SFTP from a particular site. My code works fine on other SFTP servers, however for this site im getting the below error:
ChilkatLog:
DownloadFileByName:
DllDate: Jun 23 2009
UnlockPrefix: MRCEPSSSH
Username: neal
Component: .NET 2.0
SshVersion: SSH-2.0-http://3sp.com_Maverick_SSHD
SftpVersion: 0
fromFilePath: out/Summary_051714_sttlmnt.csv
toFilePath: E:\WebSanApps\eRec\Logs\Summary_051714_sttlmnt.csv
OpenRemoteFile:
filename: out/Summary_051714_sttlmnt.csv <-- Note: I've tried both absolute (/out/) and relative (out/) paths here
access: readOnly
createDisposition: openExisting
v3Flags: 0x1
Sent FXP_OPEN
Received CHANNEL REQUEST message
requestType: exit-status
exitStatusCode: 0
Sent SSH Channel CLOSE
Received Close
Failed to read packet.
Failed to receive response to FXP_OPEN
SshLog:
SFTP> Sending SSH_FXP_OPEN
TRAN> CHANNEL_DATA
TRAN* NumBytes: 51
TRAN< CHANNEL_REQUEST
TRAN* Request Type: exit-status
TRAN* Channel: 200
TRAN< CHANNEL_CLOSE
TRAN> CHANNEL_CLOSE
TRAN* svrChannel=0
SFTP! Failed to read packet.
Failed.
UPDATE:
I was able to resolve this by requesting the realpath before opening the file handle.
Once I added this code: absPath = SFTPClient.RealPath(".", "")
the download was successful.
I have no idea why this work (as Im not even using the value returned by the function) however I suspect requesting the path triggered something on the host side. I got the idea from looking at filezilla, I was always able to download the file when using Filezilla and I noticed it requested the current directory before requesting a file listing. So I tried the same logic in my code and it now works.
This is only an issue for this specific host Im connecting to (WesternUnion), all other hosts I connect to worked fine prior to adding this. Strange...
UPDATE: I updated the DLL to latest version 9.5 and now Im getting a different error. Any ideas?
ChilkatLog:
DownloadFileByName:
DllDate: May 8 2014
ChilkatVersion: 9.5.0.39
UnlockPrefix: MRCEPSSSH
Username: C4YSERVER3A:neal
Architecture: Little Endian; 32-bit
Language: .NET 2.0
VerboseLogging: 0
SshVersion: SSH-2.0-http://3sp.com_Maverick_SSHD
SftpVersion: 3
downloadFileByName:
PreserveDate: 0
fromFilePath: out/Summary_051714_sttlmnt.csv
toFilePath: E:\WebSanApps\eRec\Logs\Summary_051714_sttlmnt.csv
OpenRemoteFile:
sftpOpenFile:
remotePath: out/Summary_051714_sttlmnt.csv
access: readOnly
createDisposition: openExisting
v3Flags: 0x1
Sent FXP_OPEN
StatusResponseFromServer:
Request: FXP_OPEN
InformationReceivedFromServer:
StatusCode: 3
StatusMessage: [2014/05/18 13:16:12.172] SSE2636 Command rejected due to sftp proxy policy settings: SSH_FXP_OPEN
--InformationReceivedFromServer
--StatusResponseFromServer
--sftpOpenFile
timeToOpenMs: Elapsed time: 125 millisec
--OpenRemoteFile
totalTimeMs: Elapsed time: 125 millisec
--downloadFileByName
Failed.
--DownloadFileByName
--ChilkatLog
Maybe a bug in IBM Sterling Secure Proxy? I Googled error SSE2636 as reported in the second LastErrorText you provided, and got this: