为什么或为什么我在服务器 A 尝试连接到服务器 B 时收到此错误???
ssh root@zk.111.sf.development.cloudera.fu.com
Warning: the ECDSA host key for 'zk.111.sf.development.cloudera.fu.com' differs from the key for the IP address '107.170.xxx.xxx'
Offending key for IP in /root/.ssh/known_hosts:4
Matching host key in /root/.ssh/known_hosts:5
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
enter code here
Run Code Online (Sandbox Code Playgroud)
在服务器 AI 上执行此操作
eval `ssh-agent -s`
ssh-keyscan 107.170.xxx.xxx | tee -a /root/.ssh/known_hosts
Run Code Online (Sandbox Code Playgroud)
然后我尝试 ssh。哇..两个服务器事件都有相同的 pub 和 private 密钥。我正在尝试在服务器之间设置无密码身份验证。
您的某些主机最近似乎更改了 IP,并且您在 IP 更改之后和之前都连接到了它们。
我建议您清理第 4 行和第 5 行中的known_hosts 文件以消除此错误消息。
另一件需要考虑的事情是:如果您只想让服务器 A 连接到服务器 B,则只需将服务器 A 公钥(id_dsa.pub 或 id_rsa.pub 的内容)放到服务器 B 的 /root/.ssh/authorized_keys 中即可。
如果您确实想要双向连接,您应该对服务器 B 到 A 执行相同的过程。
从 ssh_config(5) 手册页来看,有一种模式
\n\n\n\n\n检查主机IP
\n\n如果此标志设置为“yes”,ssh(1) 将另外检查known_hosts 文件中的主机\n IP 地址。这允许 ssh 检测主机密钥是否由于 DNS 欺骗而发生更改。如果该选项设置为“否”,则不会执行检查。默认为“是”。
\n
因此,您可以将CheckHostIP no放入/etc/ssh/ssh_config 文件中。
\n\n正如 @Vin\xc3\xadcius Ferr\xc3\xa3o 所说,它不安全。最好的主意是将CheckHostIP no放入~/.ssh/config 文件中。这里是一个示例:
\n\nHost bar.local bar\n Hostname bar.local\n CheckHostIP no\nRun Code Online (Sandbox Code Playgroud)\n\n您应该在 A 和 Bi 上执行相同的操作,认为这是启用 DHCP 的网络的最佳主意。
\n| 归档时间: |
|
| 查看次数: |
25671 次 |
| 最近记录: |