Hi, You are exactly right! On Linux #1, "/usr/bin/sftp" is the default one to use. After I explicitly ran my build "sftp", I got same result as that on Linux #2.
Do you have any ideas why "sftp" initialization failed on Linux #2? And how to debug (such as using libssh2_trace()",etc)? Linux #2> sftp xx.xx.xx.xx sxuan ******* /home/sxuan/ ------------------------------------------------------ -debug- argc = 5 -debug- argv[0] = sftp -debug- argv[1] = xx.xx.xx.xx -debug- argv[2] = sxuan -debug- argv[3] = ******* -debug- argv[4] = /home/sxuan/ -debug- username = sxuan, password = *******, sftppath = /home/sxuan/ Fingerprint: 0B F2 D3 94 9D 0F 75 BE 69 15 33 42 B8 0D 88 CA Authentication methods: publickey,gssapi-with-mic,password libssh2_sftp_init()! Unable to init SFTP session all done Best regards, Xuan ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Steven Van Ingelgem Sent: Monday, August 24, 2009 2:09 PM To: libssh2 development Subject: Re: libssh2 for SFTP It seems on Linux #1 you use the openssh sftp version and not the libssh2 sftp example. If I were you, I would try "which sftp" to determine what version you are using. 2009/8/24 Shangguan, Xuan (FXSGSC) <[email protected]<mailto:[email protected]>> Hi all, I would like to use libssh2 to write a SFTP client. I compiled the "libssh2-1.2" under two Linux environment. Both build looked ok. I then build example "sftp" to test. [Question 1]: Different default results when run "sftp". Why? Note, I added some "-debug-" printf messages in Linux #2. Linux #1> sftp --------------------- usage: sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config] [-o ssh_option] [-P sftp_server_path] [-R num_requests] [-S program] [-s subsystem | sftp_server] host sftp [[u...@]host[:file [file]]] sftp [[u...@]host[:dir[/]]] sftp -b batchfile [u...@]host Linux #2> sftp ---------------------- -debug- argc = 1 -debug- argv[0] = sftp -debug- username = username, password = password, sftppath = /tmp/TEST Fingerprint: 17 7E 8D C6 46 75 DE B4 30 8E 12 67 CB CC 8B F7 Authentication methods: publickey,password,keyboard-interactive Authentication by password failed. all done [Question 2]: Different usage support and different results. Why? And why both failed? Linux #1> sftp -v [email protected]<mailto:[email protected]> ------------------------------------------------------ Connecting to xx.xx.xx.xx... OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to xx.xx.xx.xx [xx.xx.xx.xx] port 22. debug1: Connection established. debug1: identity file /home/sxuan/.ssh/id_rsa type -1 debug1: identity file /home/sxuan/.ssh/id_dsa type -1 debug1: loaded 2 keys debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3 debug1: match: OpenSSH_4.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'xx.xx.xx.xx' is known and matches the RSA host key. debug1: Found key in /home/sxuan/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Next authentication method: gssapi-with-mic Address xx.xx.xx.xx maps to durian, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT! debug1: Unspecified GSS failure. Minor code may provide more information No credentials cache found debug1: Next authentication method: publickey debug1: Trying private key: /home/sxuan/.ssh/id_rsa debug1: Trying private key: /home/sxuan/.ssh/id_dsa debug1: Next authentication method: password [email protected]'s<mailto:[email protected]%27s> password: debug1: Authentication succeeded (password). debug1: channel 0: new [client-session] debug1: Entering interactive session. debug1: Sending environment. debug1: Sending env LANG = en_US.iso885915 debug1: Sending subsystem: sftp Received message too long 1399157876 ----------------------------------------------------- Linux #2> sftp xx.xx.xx.xx sxuan ******* /home/sxuan/ ------------------------------------------------------ -debug- argc = 5 -debug- argv[0] = sftp -debug- argv[1] = xx.xx.xx.xx -debug- argv[2] = sxuan -debug- argv[3] = ******* -debug- argv[4] = /home/sxuan/ -debug- username = sxuan, password = *******, sftppath = /home/sxuan/ Fingerprint: 0B F2 D3 94 9D 0F 75 BE 69 15 33 42 B8 0D 88 CA Authentication methods: publickey,gssapi-with-mic,password libssh2_sftp_init()! Unable to init SFTP session all done [Question 3]: How to use "libssh2_trace()" to debug? Best regards, Xuan _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
_______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
