SSH Error: data could not be sent to remote host

I have setup a new SSH key for github with (i~/.ssh/id_rsa_stub4ever), because I would like to use github instead of bitbucket. When I run this command on terminal $ ansible-playbook server.yml -e env=production. The permission of publickey is denied. I think it has to do something with my SSH config, after many attempts I am getting lost. I hope someone can help my out…

Thanks in advance! For more error details you can find it below.


Failed to connect to the host via ssh: OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /Users/stuboki/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket “/Users/stuboki/.ansible/cp/53e1f73829” does not exist
debug2: resolving “209.97.161.113” port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 209.97.161.113 [209.97.161.113] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug3: timeout: 9293 ms remain after connect
debug1: identity file /Users/stuboki/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: Offering public key: RSA
SHA256:N5bbnvu2HDpeYknluFoPo135nfdHxlXuQqZtdTjq/fk
/Users/stuboki/.ssh/id_rsa_stub4ever
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Offering public key: RSA
SHA256:qErIJLif80xFu/EBBwH4ghhP8rfM3yICYKk36gsLftY /Users/stuboki/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/stuboki/.ssh/id_dsa
debug3: no such identity: /Users/stuboki/.ssh/id_dsa: No such file or
directory
debug1: Trying private key: /Users/stuboki/.ssh/id_ecdsa
debug3: no such identity: /Users/stuboki/.ssh/id_ecdsa: No such file or
directory
debug1: Trying private key: /Users/stuboki/.ssh/id_ed25519
debug3: no such identity: /Users/stuboki/.ssh/id_ed25519: No such file or
directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
admin@209.97.161.113: Permission denied (publickey).

fatal: [209.97.161.113]: UNREACHABLE! => {
“changed”: false,
“unreachable”: true
}

The same issue, are you solved it ?

Try adding your SSH into the agenet, e.g:

$ ssh-add ~/.ssh/id_rsa_stub4ever

See:

1 Like

In my case that was issue :man_facepalming:

$ ssh-add -K