查看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 242091 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 242091 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: