Subject: Re: libssh2_userauth_publickey_fromfile with public key

Re: libssh2_userauth_publickey_fromfile with public key

From: Paresh Thakor <paresh.thakor_at_moontechnolabs.com>
Date: Thu, 23 Sep 2010 15:50:37 +0530

> Hi guys,
> I want to use libssh2_suerauth_publickey_fromfile() to copy file to remote sever.
> But there are some questions:
>
> 1. why do I have to use public key or passphrase to do the authentication?
> If public key is NULL, the error message will be "Unable to open public key file"
>
> 2. If I use
> libssh2_userauth_publickey_fromfile(session, username, "/home/caosuwei/.ssh/id_rsa.pub", "/home/caosuwei/.ssh/id_rsa", "123456"));
> the error message will be "(-18) Username/PublicKey combination invalid"
>
> What should I do with it ?

        => Please check that you have generated public and private key-pair on your system. Then you need to copy contents of your public key into authorized_keys2 file of remote computer. Remote computer is to which you need to connect.

>
> Thanks.
>
> --
> caosuwei
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-09-23