[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Private key login from windows and mingw
[Thread Prev] | [Thread Next]
- Subject: Re: Private key login from windows and mingw
- From: Alfonso Arbona Gimeno <nake90@xxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Fri, 06 Jul 2012 18:07:47 +0200
- To: libssh@xxxxxxxxxx
-----BEGIN PGP SIGNED MESSAGE----- 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. Alfonso 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_LOG_VERBOSITY, &verbosity); > 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 >> >> > > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJP9w1SAAoJECPrtc1S8vx5WCoH/2dF62lHnL8PTY5Ixa8Np29V Lry5n2Qz198QeJ565g/g8OstX7B+DeiaimivRFWrfutxvIk6QXEfmkgrvquV36Wo VdAhMg71bZZzcRLFpeSPNvhEnfwhwxnl9ScTA7nvY5s3rySz/WfSIsIy0rVGCnvY DcEqn5yyCGEwibPe2Yl3yV53T+NylPDlUCRkDSTXD9xQJKfJRUmDmw0S3StbnKkA +QK8SO8KZyvhhDpCHgmBMVakLCEOI+j6KT4f4uZOsw582h04Re9rEBQUEw1zRHLr JMqt3yivHQpP576N63pbHCJyCrU/Uy9YCzlNM0840jtSPpsFA2Ze8RBDrBmGCKQ= =eomp -----END PGP SIGNATURE-----
Private key login from windows and mingw | Alfonso Arbona Gimeno <nake90@xxxxxxxx> |
Re: Private key login from windows and mingw | Aris Adamantiadis <aris@xxxxxxxxxxxx> |