[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Private key login from windows and mingw

Hash: SHA1

Yes, that was my problem. I forgot to add the ssh_connect before
dealing with the private and public keys.

Thanks for the help.


On 06/07/2012 10:50, Aris Adamantiadis wrote:
> Hello,
> I think you miss an ssh_connect() somewhere. I agree that libssh
> should give a more useful error message like "not connected".
> Otherwise your pubkey authentication seems right to me.
> Regards,
> Aris
> Le 5/07/12 20:23, Alfonso Arbona Gimeno a écrit : Hello list,
> I'm having some trouble understanding how to login using a private
> key. This is what I do:
> my_ssh_session = ssh_new(); ssh_options_set(my_ssh_session,
> SSH_OPTIONS_HOST, server); ssh_options_set(my_ssh_session,
> ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
> privkey = privatekey_from_file(my_ssh_session,
> "C:\\data\\privatekey", 0, "pass");
> rc = ssh_userauth_pubkey(my_ssh_session, "root", NULL, privkey); 
> if(rc != SSH_AUTH_SUCCESS) error....
> privatekey_free(privkey); ...
> And the output I get says: [1] Trying to open C:\data\privatekey 
> [1] Trying to read C:\data\privatekey, passphase=true,
> authcb=false [3] Writing on the wire a packet having 17 bytes
> before [3] 17 bytes after comp + 10 padding bytes = 28 bytes
> packet [1] Error : Writing packet: error on socket (or connection
> closed): Unknown error [3] Sent SSH_MSG_SERVICE_REQUEST (service
> ssh-userauth)
> I've been trying to follow the examples and I've read the api, the 
> documentation and even part of the source code but I don't
> understand what is happening here. By the way, my ssh server only
> accepts certificate login, however I can login using Putty (with a
> copy of the same certificate exported to be putty-compatible), and
> I can also login to ssh from other programs such as MySQL Workbench
> using exactly the same certificate.
> In fact, I could connect when my server was configured to use a 
> password login, but I wanted more security than just a plain
> password. That's why I am confused about the socket error...
> I'm using the precompiled binaries for MinGW, version 0.5.2-1
> Any idea? And thanks in advance,
> Alfonso Arbona
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


Private key login from windows and mingwAlfonso Arbona Gimeno <nake90@xxxxxxxx>
Re: Private key login from windows and mingwAris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org