On Wednesday, September 26, 2018 1:22:40 PM CEST Pieter Cardoen wrote: > Hello > > I am trying to authenticate to my target system using libssh. My target > system is configured to use login without password. Using openssh ssh > client, I can login: "ssh -i <path to private key file> root@<ip address>" > gives me the prompt. > > However I am not succeeding to login to the target system using libssh. I > was following this tutorial but it wasn't that helpful because I ran into > multiple errors: > http://api.libssh.org/master/libssh_tutor_authentication.html > > I am able to load the public key using ssh_pki_import_pubkey_file with > "id_rsa.pub". Return value SSH_OK. However if I try to execute > ssh_userauth_try_publickey, I get: [2018/09/26 13:15:06.226731, 1] > ssh_packet_userauth_failure: Access denied for 'publickey'. Authentication > that can continue: publickey,password [2018/09/26 13:15:06.226816, 2] > ssh_packet_userauth_failure: Access denied for 'publickey'. Authentication > that can continue: publickey,password > > This seams fairly reasonable as I used the public key of my PC to > authenticate. However, I don't have a public key of my target system, only > the private key.
Works just fine here. I can successfully authenticate using public keys. Did you check the server log why it rejected your public key?
