使用 SSH 登录 Linux 实例时,报错 ssh_exchange_identification: Connection closed by remote host 或 no hostkey alg。
可能原因 | 处理措施 |
/var/empty/sshd 文件权限未修改 | |
/etc/ssh/ssh_host_rsa_key 文件权限未修改 |
2. 执行以下命令,查看报错原因。
sshd -t
返回类似如下信息:
“/var/empty/sshd must be owned by root and not group or world-writable.”
3. 执行以下命令,修改 /var/empty/sshd/
文件权限。
chmod 711 /var/empty/sshd/
2. 执行以下命令,查看报错原因。
sshd -t
返回信息中包含如下字段:
“/etc/ssh/ssh_host_rsa_key are too open”
3. 执行以下命令,修改 /etc/ssh/ssh_host_rsa_key
文件权限。
chmod 600 /etc/ssh/ssh_host_rsa_key