Linux ssh 远程登录到其他机器上时,有时会出现登不进去,并弹出如下类似提示的情况:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
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 the RSA host key has just been changed.The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /u/xlian008/.ssh/known_hosts to get rid of this message.
一、原因:
当ssh 远程连接主机的时候,会出现这种冲突警告。之所以会出现这种警告的原因:是当你每次ssh访问远程主机时,会把你计算机的公钥(public key)记录在~/.ssh/known_hosts,下次访问的时候,openssh会相互核对公钥,如果核实错误的话,会发出警告。
二、解决方法:清除秘钥
三、清除秘钥方法:ssh-keygen -R 接目标地址,完成后可ssh登录
四、关闭秘钥登录:修改/etc/ssh/sshd_config文件
[root@localhost ~]# vi /etc/ssh/sshd_config
#PubkeyAuthentication no ----修改为no
之后重启sshd服务并查看状态
[root@localhost ~]# systemctl restart sshd
[root@localhost ~]# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-03-17 12:53:22 CST; 7s ago
..............