ssh 提示Connection closed by * 的解决方案

ssh 提示Connection closed by * 的解决方案ssh 提示 Connectioncl 的解决方案

/* * Author : lile * Modified : 2019年12月28日星期六 10:56:13 * Email :  * HomePage : lile777.blog.csdn.net * CopyRight : 该文章版权由lile所有。 * 保留原文出处链接和本声明的前提下,可在非商业目的下任意传播和复制。 * 对于商业目的下对本文的任何行为需经作者同意。 */ 

 查看ssh服务端的日志 ubuntu@tegra-ubuntu:~$ cat /var/log/auth.log Jun 20 16:55:26 tegra-ubuntu sshd[1192]: Server listening on 0.0.0.0 port 22. Jun 20 16:55:26 tegra-ubuntu sshd[1192]: Server listening on :: port 22. Jun 20 16:55:27 tegra-ubuntu login[1313]: pam_unix(login:session): session opened for user ubuntu by LOGIN(uid=0) Jun 20 16:55:28 tegra-ubuntu lightdm: pam_unix(lightdm-autologin:session): session opened for user ubuntu by (uid=0) Jun 20 16:55:31 tegra-ubuntu polkitd(authority=local): Registered Authentication Agent for unix-session:c2 (system bus name :1.60 [/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1], object path /org/gnome/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) Jun 20 16:56:16 tegra-ubuntu sshd[2145]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key Jun 20 16:56:16 tegra-ubuntu sshd[2145]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key Jun 20 16:56:16 tegra-ubuntu sshd[2145]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key Jun 20 16:56:16 tegra-ubuntu sshd[2145]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key Jun 20 16:56:16 tegra-ubuntu sshd[2145]: fatal: No supported key exchange algorithms [preauth] ubuntu@tegra-ubuntu:~$ ubuntu@tegra-ubuntu:~$ ll /etc/ssh total 268 drwxr-xr-x 2 root root 4096 Jan 1 1970 ./ drwxr-xr-x 133 root root 12288 Jun 20 16:55 ../ -rw-r--r-- 1 root root  Apr 2 2015 moduli -rw-r--r-- 1 root root 1690 Apr 2 2015 ssh_config -rw-r--r-- 1 root root 2541 Apr 2 2015 sshd_config -rw------- 1 root root 0 Jan 1 1970 ssh_host_dsa_key -rw-r--r-- 1 root root 0 Jan 1 1970 ssh_host_dsa_key.pub -rw------- 1 root root 0 Jan 1 1970 ssh_host_ecdsa_key -rw-r--r-- 1 root root 0 Jan 1 1970 ssh_host_ecdsa_key.pub -rw------- 1 root root 0 Jan 1 1970 ssh_host_rsa_key -rw-r--r-- 1 root root 0 Jan 1 1970 ssh_host_rsa_key.pub -rw-r--r-- 1 root root 338 Apr 2 2015 ssh_import_id ubuntu@tegra-ubuntu:~$ 重新生成密钥 sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key ubuntu@tegra-ubuntu:~$ ll /etc/ssh total 292 drwxr-xr-x 2 root root 4096 Jan 1 1970 ./ drwxr-xr-x 133 root root 12288 Jun 20 16:59 ../ -rw-r--r-- 1 root root  Apr 2 2015 moduli -rw-r--r-- 1 root root 1690 Apr 2 2015 ssh_config -rw-r--r-- 1 root root 2541 Apr 2 2015 sshd_config -rw------- 1 root root 668 Jan 1 1970 ssh_host_dsa_key -rw-r--r-- 1 root root 607 Jan 1 1970 ssh_host_dsa_key.pub -rw------- 1 root root 227 Jan 1 1970 ssh_host_ecdsa_key -rw-r--r-- 1 root root 179 Jan 1 1970 ssh_host_ecdsa_key.pub -rw------- 1 root root 1679 Jan 1 1970 ssh_host_rsa_key -rw-r--r-- 1 root root 399 Jan 1 1970 ssh_host_rsa_key.pub -rw-r--r-- 1 root root 338 Apr 2 2015 ssh_import_id ubuntu@tegra-ubuntu:~$ 客户端重新登录,提示 roger@ubuntu:~$ ssh ubuntu@192.168.0.224 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the DSA key sent by the remote host is 89:5a:d2:79:cc:66:7c:5e:dd:64:ef:05:dd:83:25:e1. Please contact your system administrator. Add correct host key in /home/roger/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /home/roger/.ssh/known_hosts:2 remove with: ssh-keygen -f "/home/roger/.ssh/known_hosts" -R 192.168.0.224 DSA host key for 192.168.0.224 has changed and you have requested strict checking. Host key verification failed. 清除当前的密钥 roger@ubuntu:~$ ssh-keygen -f "/home/roger/.ssh/known_hosts" -R 192.168.0.224 # Host 192.168.0.224 found: line 2 type ECDSA /home/roger/.ssh/known_hosts updated. Original contents retained as /home/roger/.ssh/known_hosts.old roger@ubuntu:~$ 重新登录即可 roger@ubuntu:~$ ssh ubuntu@192.168.0.224 The authenticity of host '192.168.0.224 (192.168.0.224)' can't be established. DSA key fingerprint is 89:5a:d2:79: 


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/178749.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月26日 下午4:34
下一篇 2026年3月26日 下午4:34


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号