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服务

 

posted @ 2024-02-28 15:12  做人如水,做事如山  阅读(2058)  评论(0编辑  收藏  举报