Host机 ip地址发生变换导致客户机ssh无法访问host机

问题描述:

Host机 ip地址发生变换导致客户机ssh无法访问host机,错误如下:

$ ssh XX@192.168.0.103
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote host is
SHA256:SdFQGwDlfRQhtEC9T2LaUAnRyTMGgCjVsStXdoinUtU.
Please contact your system administrator.
Add correct host key in /home/XX/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/XX/.ssh/known_hosts:1
  remove with:
  ssh-keygen -f "/home/XX/.ssh/known_hosts" -R "192.168.0.103"
ECDSA host key for 192.168.0.103 has changed and you have requested strict checking.
Host key verification failed.

解决方案:

在host机查询host机新的ip地址,假如查询后地址为192.168.0.103
在客户机按照如下操作

$ cd ~/.ssh
$ ll
-rw------- 1 jpma jpma 1679 520 21:48 id_rsa
-rw-r--r-- 1 jpma jpma  404 520 21:48 id_rsa.pub
-rw------- 1 jpma jpma 2438 529 14:09 known_hosts
-rw-r--r-- 1 jpma jpma 1554 520 19:48 known_hosts.old
$ rm known_hosts
$ ssh jpma@192.168.0.103
The authenticity of host '192.168.0.103 (192.168.0.103)' can't be established.
ECDSA key fingerprint is SHA256:SdFQGwDlfRQhtEC9T2LaUAnRyTMGgCjVsStXdoinUtU.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.103' (ECDSA) to the list of known hosts.
jpma@192.168.0.103's password: 
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-73-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage


 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

389 packages can be updated.
1 update is a security update.

Your Hardware Enablement Stack (HWE) is supported until April 2023.
Last login: Sat May 22 23:22:21 2021 from 192.168.0.105
xhost:  unable to open display ""
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值