cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Can't connect to a SFTP site using private key

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Thu, 19 Apr 2012 08:16:06 -0400

On Thu, Apr 19, 2012 at 3:52 AM, Yura Kaidalov <kaidalov_at_gmail.com> wrote:
> Hello
>
> I'm trying to connect to a SFTP site using private key, however command
> fails. Here's command itself and cURL output:
> curl.exe --key privatekey.ppk sftp://uname@hostname/~ -v
> * About to connect() to hostname port 22 (#0)
> * Trying XX.XX.XX.XX... connected
> * SSH authentication methods available:
> publickey,gssapi-keyex,gssapi-with-mic,password
> * Using ssh public key file id_dsa.pub
> * Using ssh private key file privatekey.ppk
> * SSH public key authentication failed: Unable to open public key file
> * Authentication failure
> * Closing connection #0
> curl: (67) Authentication failure
>
> The command works only when I specify both public and private keys. However
> as far as I know, it should be enough to have only one key for successful
> connection (at least I was able to connect to the host with private key only
> using another sftp client).
>
> Here's my questions: is there are any way to connect to a host using private
> key only? And why does curl needs both public and private keys to make a
> connection?

You need both keys. The public key should be on the remote host. I
just tried it from one Linux system to another, and it only works for
a given private key when the matching public key is in the
$HOME/.ssh/authorized_keys file.

Ralph Mitchell
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-19