当我执行:
ssh root@myVPS
Run Code Online (Sandbox Code Playgroud)
我收到下一个警告:
Warning: the RSA host key for 'myVPS' differs from the key for the IP address 'xxx.xx.xxx.xx'
Offending key for IP in /home/manolo/.ssh/known_hosts:1
Matching host key in /home/manolo/.ssh/known_hosts:2
Are you sure you want to continue connecting (yes/no)?
Run Code Online (Sandbox Code Playgroud)
如果我输入“是”,我工作正常,但我不知道为什么会抛出这个警告。关于为什么抛出它以及如何避免它的任何建议?
Sve*_*ven 21
很可能,您会在某个时候重新安装 VPS 并保留主机名和/或 IP 地址。重新安装时,VPS 的主机密钥重新生成,并且由于它与~/.ssh/known_hosts您的 . 这样做是为了防止您连接到替换合法主机的完全不同的系统,例如收集密码。
如果发生了类似的事情,只需从known_hosts文件中删除有问题的密钥,一切都很好,但是如果您不知道这样的 rinstall,则必须进一步调查以了解密钥为何不同。