curl-library
RE: libcurl and libssh2
Date: Thu, 15 Oct 2009 10:21:38 +0800
> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Michael Wood
> Sent: Wednesday, October 14, 2009 6:12 PM
> To: libcurl development
> Subject: Re: libcurl and libssh2
>
> Well, your ssh-keygen seems to be different from mine. Maybe
> a different version. If I add that key to my known_hosts file, I get
> this:
>
> $ ssh-keygen -F 13.198.98.190 -l -f ~/.ssh/known_hosts
> # Host 13.198.98.190 found: line 71 type RSA
> 2048 0b:f2:d3:94:9d:0f:75:be:69:15:33:42:b8:0d:88:ca
> 13.198.98.190 (RSA)
>
> This is clearly different from your actual host key.
>
> Since ssh-keygen -l doesn't seem to work on your client
> machine you could also just check the actual keys directly.
> See if one of the other /etc/ssh/ssh_host*key.pub files
> matches. Maybe that is an SSH1 key in your known_hosts file?
>
> Can you connect using "ssh -2 13.198.98.190" without it
> asking to accept the host key?
Well, although something is wrong with my key file, it is not the root cause of the transfer failure. Just found that all the fuss is caused by a negligence on my side.
In testing for ftp, I used the command "./curl -v -u qxu:fair123 -T CMakeLists.txt ftp://13.198.98.202/scan/test.txt", and it works well. In testing for sftp, I still pointed the server to 13.198.98.202, and used the command "./curl -v -u qxu:fair123 -T CMakeLists.txt sftp://13.198.98.202/scan/test.txt". It doesn't work, coz 13.198.98.202 is ftp server, not sftp server. As soon as sftp server's IP address is filled in correctly, it works.
Still, there is some problem:
=========================================================
qxu@durian(pts/0):~/opensrc/curl-7.19.6/src[114]$ ./curl -v -u qxu:fair123 -T CMakeLists.txt sftp://13.198.98.190/scan/test.txt
* About to connect() to 13.198.98.190 port 22 (#0)
* Trying 13.198.98.190... connected
* Connected to 13.198.98.190 (13.198.98.190) port 22 (#0)
* Failed to read known hosts from /home/qxu/.ssh/known_hosts
* SSH host check: 0, key: AAAAB3[...]
* SSH authentication methods available: publickey,gssapi-with-mic,password
* Using ssh public key file /home/qxu/.ssh/id_dsa.pub
* Using ssh private key file /home/qxu/.ssh/id_dsa
* SSH public key authentication failed: Unable to open public key file
* Initialized password authentication
* Authentication complete
* Upload failed: No such file or directory (2/-31)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0*
Connection #0 to host 13.198.98.190 left intact
curl: (78) Upload failed: No such file or directory (2/-31)
* Closing connection #0
qxu@durian(pts/0):~/opensrc/curl-7.19.6/src[115]$ ./curl -v -u qxu:fair123 -T CMakeLists.txt sftp://13.198.98.190//home/qxu/scan/test.txt
* About to connect() to 13.198.98.190 port 22 (#0)
* Trying 13.198.98.190... connected
* Connected to 13.198.98.190 (13.198.98.190) port 22 (#0)
* Failed to read known hosts from /home/qxu/.ssh/known_hosts
* SSH host check: 0, key: AAAAB3[...]
* SSH authentication methods available: publickey,gssapi-with-mic,password
* Using ssh public key file /home/qxu/.ssh/id_dsa.pub
* Using ssh private key file /home/qxu/.ssh/id_dsa
* SSH public key authentication failed: Unable to open public key file
* Initialized password authentication
* Authentication complete
} [data not shown]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2106 0 0 100 2106 0 11745 --:--:-- --:--:-- --:--:-- 11745*
Connection #0 to host 13.198.98.190 left intact
* Closing connection #0
=========================================================
Even something is wrong with the public key file, the connection is successful. After all, I am using user and password authentication. But, the upload fails when I specifies the relative remote folder (13.198.98.190/scan), and the upload succeeds when I uses the absolute remote path (13.198.98.190//home/qxu/scan).
It is strange, coz when I telnet into 13.198.98.190 with my account "qxu/fair123", the default path is my home directly (/home/qxu). So a relative path (scan) should work, shouldn't it? I am also using the relative path in ftp connection to 13.198.98.202 with curl, and it is successful.
What is the possible reason behind the scenario?
Thanks,
Xu Qiang
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-10-15