当我 ssh 进入一台新机器时,我遇到了这个奇怪的问题,但我的known_hosts 文件会使用某种哈希值进行更新,但不会更新主机名。当我稍后尝试通过 SSH 连接到同一台机器时,这最终导致我无法自动完成。
例如:
我的known_hosts 文件的最后两行:
10.1.x.xx ecdsa-sha2-nistp256 AAAAE2VjZHNhLXN ... the rest of the hash
db03.test.fqdn.com ecdsa-sha2-nistp256 AAAAE2 ... the rest of the hash
Run Code Online (Sandbox Code Playgroud)
我通过 SSH 连接到盒子:
#ssh app01.test.fqdn.com
[~]$ ssh app01.test.fqdn.com
The authenticity of host 'app01.test.fqdn.com (10.1.2.92)' can't be established.
ECDSA key fingerprint is SHA256:2zbk+M6WbAwjBbtODTklKDqctO/b2JQgirf4LWGh3jE.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'app01.test.fqdn.nl,10.1.x.xx' (ECDSA) to the list of known hosts.
Last login: Tue Feb 15 09:58:51 2022 from 10.1.x.xx
app01:[~]$ …
Run Code Online (Sandbox Code Playgroud)