During login to a Linux instance via SSH key, "ssh_exchange_identification: Connection closed by remote host" or "no hostkey alg" is displayed.
sshd configuration file permissions, such as the permissions of the
/etc/ssh/ssh_host_rsa_key configuration file, are modified, which may cause a failure in login via SSH key.
Perform the steps based on the actual error message to modify the configuration file permissions:
Information similar to the following is returned:
"/var/empty/sshd must be owned by root and not group or world-writable."
chmod 711 /var/empty/sshd/
The returned information contains the following field:
"/etc/ssh/ssh_host_rsa_key are too open"
chmod 600 /etc/ssh/ssh_host_rsa_key