ssh 登录linux报错Connection closed by foreign host
1、 背景ip跟端口正常,防火墙已经关闭
2、使用ssh登录服务器出现问题
Connecting to 10.10.107.61:22... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Connection closed by foreign host. Disconnected from remote host(Ubuntu 18.04 LTS) at 14:57:24. Type `help' to learn how to use Xshell prompt
3、解决
由于ssh的秘钥问题导致了链接被拒绝了
rm /etc/ssh/ssh_host_*
重新生成秘钥
ssh-keygen -A
生成秘钥后重启sshd服务