When putty uses the public key for authentication, the following error occurs: disconnected: No supported authentication methods available (server sent: Public Key ).
For example:
After searching for half a day, I couldn't find out what the problem was. sshd settings were all normal. This can be an error even if it has been done many times ????
It turns out to be ~ The content of the/. Ssh/authorized_keys file is incorrect. The pub file format generated by Putty is as follows:
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key"
AAAAB3NzaC1yc2EAAAABJQAAAQEAvifBFJzxK0PGJVNV9ZdDGOYWvytwnFDKoaZv
Djdt7rEK+zeFzR6eU7ERhOjMPb7GfoFU/1JPwXqSN2p57T4xdtR/Qi9/XAhmQ9SY
XnfA1yNOhHXoQuoCEjOmIbOo+NmZCoKPeBob7fXV8Ar7MmJ0vUpZ+79Usm9lsvQF
zEfI/Q1NuaVoOb7s6CFyj9WcmX7Yzc3cXpIHeFzLfLTFFROohw==
---- END SSH2 PUBLIC KEY ----
The original settings are in the format of one row. Therefore, OpenSSH does not support the format generated by putty. You need to merge the format into one row:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAvifBFJzxK0PGJVNV9ZdDGOYWvytwnFDKoaZvDjdt7rEK+zeFzR6eU7ERhOjMPb7GfoFU/1JPwXqSN2p57T4xdtR/Qi9/XAhmQ9SYXnfA1yNOhHXoQuoCEjOmIbOo+NmZCoKPeBob7fXV8Ar7MmJ0vUpZ+79Usm9lsvQFzEfI/1NuaVoOb7s6CFyj9WcmX7Yzc3cXpIHeFzLfLTFFROohw== rsa-key