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