Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.2k views
in .NET FTP by (200 points)
Hello,
I am trying to make connection to SFTP site (with server validation off) and I am getting "File not found : / (code=2)" error message after I have made a connection and try to get file listing by calling GetFiles()? Any idea why I am getting this error message? I am getting same error message if I try running from Examples! Let me know if you need anything else.

Below is the DEBUG log...

Connecting to server ftp.xxxxxxxxxxxxxxxxxx.net
INFO [LicenseProperties] 25 Nov 2008 11:52:13.684 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 25 Nov 2008 11:52:13.684 : Production license
DEBUG [FTPConnection] 25 Nov 2008 11:52:13.684 : Set LocalDirectory='F:\Projects\FTPClient\FTPClient\bin\Debug'
INFO [LicenseProperties] 25 Nov 2008 11:52:13.700 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 25 Nov 2008 11:52:13.700 : Production license
DEBUG [SSHFTPClient] 25 Nov 2008 11:52:13.700 : Setting up fallback kbi prompt based on supplied password
DEBUG [HostNameResolver] 25 Nov 2008 11:52:13.700 : ftp.xxxxxxxxxxxxxxxxxx.net resolved to xx.xx.xx.xx
DEBUG [SSHFTPClient] 25 Nov 2008 11:52:13.700 : Connecting directly to SFTP server xx.xx.xx.xx:22
DEBUG [SSHFTPClient] 25 Nov 2008 11:52:13.747 : Connected successfully to SFTP server xx.xx.xx.xx:22
DEBUG [SSHConnection] 25 Nov 2008 11:52:13.747 : Beginning protocol negotiation
DEBUG [PlainSocket] 25 Nov 2008 11:52:13.793 : RepeatCallback received 34 bytes
DEBUG [ProtocolNegotiationHandler] 25 Nov 2008 11:52:13.793 : offset=0,length=34
DEBUG [ProtocolNegotiationHandler] 25 Nov 2008 11:52:13.793 : pos=33
INFO [ProtocolNegotiationHandler] 25 Nov 2008 11:52:13.793 : Server version = SSH-2.0-1.36 sshlib: GlobalScape
DEBUG [PlainSocket] 25 Nov 2008 11:52:13.793 : RepeatCallback received 352 bytes
DEBUG [SSHConnection] 25 Nov 2008 11:52:13.793 : Server version=SSH-2.0-1.36 sshlib: GlobalScape
DEBUG [ProtocolNegotiationHandler] 25 Nov 2008 11:52:13.825 : offset=0,length=352
DEBUG [ProtocolNegotiationHandler] 25 Nov 2008 11:52:13.825 : More data arrived after protocol negotiation completed
DEBUG [ProtocolNegotiationHandler] 25 Nov 2008 11:52:13.825 : 352 surplus bytes received
DEBUG [SSH2Connection] 25 Nov 2008 11:52:13.825 : Timeout=120000
DEBUG [SSH2PacketBuilder] 25 Nov 2008 11:52:13.825 : ConstructPacket: _cipher=null,len=348
DEBUG [SSH2PacketBuilder] 25 Nov 2008 11:52:13.825 : Writeoffset=352,Readoffset=352
DEBUG [SSHConnection] 25 Nov 2008 11:52:13.825 : Sending client version=SSH-2.0-edtFTPnet/PRO-5.1.0.0
DEBUG [SSH2Connection] 25 Nov 2008 11:52:13.825 : Starting key exchange
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.825 : Sending SSH_MSG_KEXINIT
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.825 : Client hostkey algorithms=ssh-dss,ssh-rsa
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.825 : Client ciphers=aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,3des-cbc
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.825 : Client ciphers=aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,3des-cbc
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Client MACs=hmac-sha1,hmac-md5
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Client MACs=hmac-sha1,hmac-md5
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Client compression algorithms=none,zlib
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Client compression algorithms=none,zlib
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Sent SSH_MSG_KEXINIT
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Reading SSH_MSG_KEXINIT reply
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Processing SSH_MSG_KEXINIT reply
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Kex alg=diffie-hellman-group1-sha1
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Hostkey alg=ssh-dss
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Cipher CS=twofish-cbc,twofish128-cbc,blowfish-cbc,3des-cbc,arcfour,cast128-cbc,
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Cipher C->S= Blowfish
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Cipher SC=twofish-cbc,twofish128-cbc,blowfish-cbc,3des-cbc,arcfour,cast128-cbc,
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : Cipher S->C= Blowfish
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : MAC CS=hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.840 : MAC C->S= HMACSHA1
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.856 : MAC SC=hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.856 : MAC S->C= HMACSHA1
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.856 : Comp CS=zlib,none
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.856 : Comp C->S=None
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.856 : Comp SC=zlib,none
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.856 : Comp S->C=None
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.856 : Processed SSH_MSG_KEXINIT reply
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.856 : Sending SSH_MSG_KEXDH_INIT
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.872 : Sent SSH_MSG_KEXDH_INIT
DEBUG [KeyExchanger] 25 Nov 2008 11:52:13.872 : Reading SSH_MSG_KEXDH_INIT reply
DEBUG [SSH2Connection] 25 Nov 2008 11:52:13.872 : Waiting for packet
DEBUG [PlainSocket] 25 Nov 2008 11:52:14.028 : RepeatCallback received 656 bytes
DEBUG [SSH2PacketBuilder] 25 Nov 2008 11:52:14.028 : ConstructPacket: _cipher=null,len=636
DEBUG [SSH2PacketBuilder] 25 Nov 2008 11:52:14.028 : ConstructPacket: _cipher=null,len=12
DEBUG [SSH2PacketBuilder] 25 Nov 2008 11:52:14.028 : Writeoffset=656,Readoffset=656
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.028 : Packet arrived
DEBUG [KeyExchanger] 25 Nov 2008 11:52:14.028 : Processing SSH_MSG_KEXDH_INIT reply
DEBUG [KeyExchanger] 25 Nov 2008 11:52:14.059 : Processed SSH_MSG_KEXDH_INIT reply successfully
DEBUG [KeyExchanger] 25 Nov 2008 11:52:14.059 : Sending SSH_MSG_NEWKEYS
DEBUG [KeyExchanger] 25 Nov 2008 11:52:14.059 : Sent SSH_MSG_NEWKEYS
DEBUG [KeyExchanger] 25 Nov 2008 11:52:14.075 : Established ciphers
DEBUG [KeyExchanger] 25 Nov 2008 11:52:14.075 : Established MACs
DEBUG [KeyExchanger] 25 Nov 2008 11:52:14.075 : Reading SSH_MSG_NEWKEYS reply
DEBUG [KeyExchanger] 25 Nov 2008 11:52:14.075 : Processing SSH_MSG_NEWKEYS reply
DEBUG [KeyExchanger] 25 Nov 2008 11:52:14.075 : Processed SSH_MSG_NEWKEYS reply
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.075 : Key exchange complete
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.075 : Sent SSH_MSG_SERVICE_REQUEST 'ssh-userauth'
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.075 : Waiting for packet
DEBUG [PlainSocket] 25 Nov 2008 11:52:14.340 : RepeatCallback received 136 bytes
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.356 : Packet arrived
DEBUG [SSH2PacketBuilder] 25 Nov 2008 11:52:14.356 : Writeoffset=136,Readoffset=136
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.356 : Starting user authentication
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.356 : Password authentication
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.356 : Sent SSH_MSG_USERAUTH_REQUEST
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.356 : ProcessAuthenticationResponse: SSH_MSG_USERAUTH_BANNER
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.356 : USERAUTH_BANNER
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.356 : Waiting for packet
DEBUG [PlainSocket] 25 Nov 2008 11:52:14.403 : RepeatCallback received 36 bytes
DEBUG [SSH2PacketBuilder] 25 Nov 2008 11:52:14.403 : Writeoffset=36,Readoffset=36
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.403 : Packet arrived
DEBUG [SSH2Connection] 25 Nov 2008 11:52:14.403 : ProcessAuthenticationResponse: SSH_MSG_USERAUTH_SUCCESS
D

7 Answers

0 votes
by (162k points)
It's trying to list the root directory, which you probably don't have permission to list.

Do you know what directory you should end up in?

You could set ServerDirectory = "/home/mydir" (or to whatever your home dir is).
0 votes
by (200 points)
On the server, we do have home directory set to some folder! I thought when I log in, it should put me in the home directory! I tried setting ServerDirectory as you specified, but not luck. Also, right after connecting, I tried Changing the working directory (ftpConnection.ChangeWorkingDirectory("/folder1/");), but I get the same error. I tried connecting to the same using third party FTP tool and it is able to connect fine!
0 votes
by (162k points)
So are you using

ftp.ServerDirectory = "/folder1/";

?
0 votes
by (162k points)
Could you try logzilla, and post the log file of what happens when you log in? that should help figure out the problem.

http://www.enterprisedt.com/tools/LogZilla.zip

thanks
0 votes
by (200 points)
Status: Connecting to ftp.xxxxxxxxx.net:22 ...
Trace: FzSFtp.exe: FzSFtp started and initialized.
Status: Connected with ftp.xxxxxxxx.net:22, initializing SFTP connection...
Command: CONNECT xxxxxxxxx@ftp.xxxxxxx.net:22
Trace: FzSFtp.exe: Ssh.c(877): Server version: SSH-2.0-1.36 sshlib: GlobalScape
Trace: FzSFtp.exe: Ssh.c(877): We claim version: SSH-2.0-PuTTY_FZ_Local:_Jun_15_2007_11:10:27
Trace: FzSFtp.exe: Ssh.c(877): Using SSH protocol version 2
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_KEXINIT(20) - 342 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_KEXINIT(20) - 495 bytes
Trace: FzSFtp.exe: Ssh.c(877): Using Diffie-Hellman with standard group "group1"
Trace: FzSFtp.exe: Ssh.c(5468): Doing Diffie-Hellman key exchange
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_KEXDH_INIT/SSH2_MSG_KEX_DH_GEX_REQUEST(30) - 138 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_KEXDH_REPLY/SSH2_MSG_KEX_DH_GEX_GROUP(31) - 635 bytes
Trace: FzSFtp.exe: Ssh.c(5556): Host key fingerprint is:
Trace: FzSFtp.exe: Ssh.c(5557): ssh-dss 1024 5f:3b:34:0d:37:d6:19:f3:15:1b:65:0e:43:79:c4:2f
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_NEWKEYS(21) - 6 bytes
Trace: FzSFtp.exe: Ssh.c(877): Initialised Blowfish client->server encryption
Trace: FzSFtp.exe: Ssh.c(877): Initialised HMAC-SHA1 client->server MAC algorithm
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_NEWKEYS(21) - 6 bytes
Trace: FzSFtp.exe: Ssh.c(877): Initialised Blowfish server->client encryption
Trace: FzSFtp.exe: Ssh.c(877): Initialised HMAC-SHA1 server->client MAC algorithm
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_SERVICE_REQUEST(5) - 22 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_SERVICE_ACCEPT(6) - 22 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_USERAUTH_REQUEST(50) - 40 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_USERAUTH_BANNER(53) - 54 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_USERAUTH_FAILURE(51) - 29 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_USERAUTH_REQUEST(50) - 57 bytes
Trace: FzSFtp.exe: Ssh.c(7165): Sent password
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_USERAUTH_SUCCESS(52) - 6 bytes
Trace: FzSFtp.exe: Ssh.c(6584): Access granted
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_OPEN(90) - 29 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_CHANNEL_OPEN_CONFIRMATION(91) - 22 bytes
Trace: FzSFtp.exe: Ssh.c(7262): Opened channel for session
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_REQUEST(98) - 32 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_CHANNEL_SUCCESS(99) - 10 bytes
Trace: FzSFtp.exe: Ssh.c(7517): Started a shell/command
Trace: FzSFtp.exe: Sftp.c(86): Sending SFTP message SSH_FXP_INIT(1) - 5 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 18 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 19 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 23 bytes
Trace: FzSFtp.exe: Sftp.c(86): Received SFTP message SSH_FXP_VERSION(2) - 5 bytes
Trace: FzSFtp.exe: Sftp.c(86): Sending SFTP message SSH_FXP_REALPATH(16) - 10 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 18 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 24 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 41 bytes
Trace: FzSFtp.exe: Sftp.c(86): Received SFTP message SSH_FXP_NAME(104) - 23 bytes
Response: Remote working directory is /
Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: Remote directory is /
Command: LIST
Trace: FzSFtp.exe: Sftp.c(86): Sending SFTP message SSH_FXP_REALPATH(16) - 11 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 18 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 25 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 41 bytes
Trace: FzSFtp.exe: Sftp.c(86): Received SFTP message SSH_FXP_NAME(104) - 23 bytes
Trace: FzSFtp.exe: Sftp.c(86): Sending SFTP message SSH_FXP_OPENDIR(11) - 10 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 18 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 24 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 28 bytes
Trace: FzSFtp.exe: Sftp.c(86): Received SFTP message SSH_FXP_HANDLE(102) - 10 bytes
Trace: FzSFtp.exe: Sftp.c(86): Sending SFTP message SSH_FXP_READDIR(12) - 10 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 18 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 24 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 459 bytes
Trace: FzSFtp.exe: Sftp.c(86): Received SFTP message SSH_FXP_NAME(104) - 441 bytes
Trace: FzSFtp.exe: Sftp.c(86): Sending SFTP message SSH_FXP_READDIR(12) - 10 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 18 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 24 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 40 bytes
Trace: FzSFtp.exe: Sftp.c(86): Received SFTP message SSH_FXP_STATUS(101) - 22 bytes
Trace: FzSFtp.exe: Sftp.c(86): Sending SFTP message SSH_FXP_CLOSE(4) - 10 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 18 bytes
Trace: FzSFtp.exe: Ssh.c(877): Sending SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 24 bytes
Trace: FzSFtp.exe: Ssh.c(877): Received SSH2 message SSH2_MSG_CHANNEL_DATA(94) - 39 bytes
Trace: FzSFtp.exe: Sftp.c(86): Received SFTP message SSH_FXP_STATUS(101) - 21 bytes
Response: Successfully received 4 items
Trace: drwxrw-rw- 1 user group 0 Nov 25 15:53 xxxxxxx
Trace: -rw-rw-rw- 1 user group 1781 Jul 10 07:29 xxxxxxxxxx.xxx
Trace: drwxrw-rw- 1 user group 0 Nov 19 14:42 xxxxxxxx
Trace: drwxrw-rw- 1 user group 0 Dec 28 2007 xxxxx
Status: Directory listing successful
0 votes
by (162k points)
We've made a fix for this - please email support at enterprisedt dot com for the patch. Please indicate if you want a .NET 1.1 build, otherwise it will be for .NET 2.0+
0 votes
by (162k points)
Followup for forum readers - this is fixed & in 6.0 which will be released soon.

Categories

...