SSH keys - Permission denied (publickey,keyboard-interactive)

Hi, Im having trouble setting the authorize keys. Im not sure how to set it up. Should I add the public Key?

In Mac im getting “Permission denied (publickey,keyboard-interactive)” each time I try to login.

{
"authorized_keys": [
"MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgHG/jMTSy7CvD75EdkK/cJ7syV/o
1oHOyJKcLSb8y62xjMUvZYVcuQtlD1FBAiv1+EO7tEMEX5Fek/buurY5HRdPzGI+
RFntyZ3RG8HSSuqtwhf07XgiUDxOSVOdZAFFyd+qGFaE7hoNaHEnxZm0TkVAWYSr
LtoSol2FbMa1NPt9AgMBAAE="
]
}
5 Likes

Not sure about mac, but the easiest way to do this in linux is by using ssh-copy-id user@machine
Seems like it should be installed per default on mac nowdays.

Also, my .ssh/authorized_hosts file is different from your example. Once again, I don’t know how the mac version does it. Linux uses one row per key, looking something like this:
ssh-rsa THEKEY....................... username@machine

   {
 "authorized_keys": [
   "ssh-rsa AAAAB3NzaC1yc2EXXXX.....XXX...== [email protected]"]}

same as in .ssh/authorized_keys

still get

MBP-de-JIS:.ssh jis$  ssh 192.168.1.124
Permission denied (publickey,keyboard-interactive).

I tried, reboot the whole system and reinstalling ssh

Log only states

starting version 3.2.1

Permission denied (publickey,keyboard-interactive). is what you are getting from the target host.

Authorized Keys should be on the system you are signing into and should be the public key. If on a linux system, it should be in /home/username/.ssh/authorized_keys Also, permissions should 600 or rw for the user. The brackets looks like its encased in json, you probably only need: MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgHG/jMTSy7CvD75EdkK/cJ7syV/o 1oHOyJKcLSb8y62xjMUvZYVcuQtlD1FBAiv1+EO7tEMEX5Fek/buurY5HRdPzGI+ RFntyZ3RG8HSSuqtwhf07XgiUDxOSVOdZAFFyd+qGFaE7hoNaHEnxZm0TkVAWYSr LtoSol2FbMa1NPt9AgMBAAE=

I have tripled check public keys in host, permissions, and copy them in hass.io module.

I cannot find the problem

heres is my log

MBP-de-JIS:.ssh jis$ ssh -vvv 192.168.1.124
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving “192.168.1.124” port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 192.168.1.124 [192.168.1.124] port 22.
debug1: Connection established.
debug1: identity file /Users/jis/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jis/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jis/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jis/.ssh/id_dsa-cert type -1
debug1: identity file /Users/jis/.ssh/id_ecdsa type 3
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jis/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jis/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jis/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 192.168.1.124:22 as ‘jis’
debug3: hostkeys_foreach: reading file “/Users/jis/.ssh/known_hosts”
debug3: record_hostkey: found key type ECDSA in file /Users/jis/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 192.168.1.124
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: compression: none
debug1: kex: client->server cipher: [email protected] MAC: compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:JJrP0yJp60+qpLrdeG5QehhLSfbQc9ciTMrTkEfYfKo
debug3: hostkeys_foreach: reading file “/Users/jis/.ssh/known_hosts”
debug3: record_hostkey: found key type ECDSA in file /Users/jis/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 192.168.1.124
debug1: Host ‘192.168.1.124’ is known and matches the ECDSA host key.
debug1: Found key in /Users/jis/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: /Users/jis/.ssh/id_rsa (0x7febe0c0beb0)
debug2: key: /Users/jis/.ssh/id_dsa (0x0)
debug2: key: /Users/jis/.ssh/id_ecdsa (0x7febe0c0bfa0)
debug2: key: /Users/jis/.ssh/id_ed25519 (0x0)
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,keyboard-interactive
debug3: start over, passed a different list publickey,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/jis/.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,keyboard-interactive
debug1: Trying private key: /Users/jis/.ssh/id_dsa
debug3: no such identity: /Users/jis/.ssh/id_dsa: No such file or directory
debug1: Offering ECDSA public key: /Users/jis/.ssh/id_ecdsa
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,keyboard-interactive
debug1: Trying private key: /Users/jis/.ssh/id_ed25519
debug3: no such identity: /Users/jis/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey,keyboard-interactive).
MBP-de-JIS:.ssh jis$

Make sure that when you connect to the host, you have loaded your private key first: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#adding-your-ssh-key-to-the-ssh-agent

It need look like this:

Solved. It was the ssh user, not key related. I was using “pi” as a user . Hass.io uses root as the ssh user.
Thanks!

6 Likes

I had this exact issue :slight_smile:

2 Likes

Thank you for this, it solved my problem too. However I cannot figure out how to change from root to pi-user. (I know, I am a Linux noob). If I try it gives the message that there is no ‘pi’ user… ?

“pi” user is coming from raspbian. Since Hass.IO run on many more system we run with linux default user. So you can not change that.

1 Like

Thank you very much! That makes sense.

Me too!

I think this should be added to the docs to save others the same trouble. Its not obvious, especially if you are coming from Rassbian.

EDIT: added this to the docs now. =)

1 Like

Not allowing me to save mine. Hass.io supervisor version 0.37, Host OS 0.8. Save button is greyed out. Have I got the syntax right?

Can it be because you don’t have a space before "ssh-ras ?
Compare your pictures agents the picture posted before yours post

No amount of formatting changes allows the Save box to be clicked.

Chatted to the team on Gitter tonight and thanks to @mihalski, got it working. DO NOT paste your saved public key text from Notepad++ or Atom. Copy direct from the top of the PuTTyGen window and paste that. The save box now works. Log in with root, enter your PuTTyGen keyphrase once and good to go from there on in. Video coming!

The authorized_keys file should be all on one line. The Options window wraps it, but there CANNOT be any CR/LF in the text.

1 Like

A clue for anyone facing this same issue, using this screenshot as an example is the right hand margin and how each line finishes at a different point. This would indicate a carriage return as its not filling the whole row.

So if you are pasting your key and you don’t see it filling the whole row, you have carriage returns in your key.

One way of making sure you don’t have any carriage returns is use a good text editor like, Notepad++, TextWranger, BBEdit or similar and turn on the invisible characters option so you can see every space and carriage return. Or checking the line wrapping settings, to make sure the program isn’t hard wrapping lines or adding carriage returns or line feeds in itself.

1 Like

Figured it out after a Gitter session with the team. Video on how to enable SSH in Hass.io here https://www.youtube.com/watch?v=GYJTy3UniHc