该文档介绍了如何为安全 Shell 远程登录重置和重新创建身份验证信息。
症状
当试图以远程方式登录 Xserve 时,出现诸如“无法建立主机的身份验证”的警告消息。
受影响的产品
解决方法
删除,然后重新创建与特定主机相关的身份验证密钥。
要点:
- 请确保您拥有适当的 Xserve 的 IP 地址和 Admin 登录信息。
- 验证与适当的 Xserve 对应的序列号的前 8 个字符。
- 请确保管理计算机安装了 Mac OS X 10.1 以上的版本。
当 RSA 主机密钥的身份验证无效时,警告消息将会指出是哪个主机文件及该文件中哪个行号的行是无效的。例如:
Offending key in /Users/admin/.ssh/known_hosts2:42
在该示例中,known_hosts2 具有无效的身份验证密钥,并且
known_hosts2 第 42 行的主机是一个需要删除的行。
注意:警告消息包含一些非常苛刻的措词,但也有一些关于身份验证密钥不匹配的非重要原因。
错误消息示例:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ ? ? ? WARNING: POSSIBLE DNS SPOOFING DETECTED! ? ? ? ? ?@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for xxxxxx has changed,
and the key for the according IP address 17.xxx.xxx.xx
is unchanged. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /Users/admin/.ssh/known_hosts2:44
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ ? ?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
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Please contact your system administrator.
Add correct host key in /Users/admin/.ssh/known_hosts2 to get rid of this message.
Offending key in /Users/admin/.ssh/known_hosts2:42
RSA host key for xxxxxxx has changed and you have requested strict checking.
The authenticity of host 'xxxxxx (17.xxx.xxx.xx)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)?
如何删除和重新创建身份验证密钥
- 在管理计算机上打开 TextEdit。它位于 /Applications/ 中。
- 打开文件:~/.ssh/known_hosts or ~/.ssh/known_hosts2。之前连接的所有指纹都将显示出来。
- 在您想要连接使用 ssh 的文本中找到服务器的主机名或 IP 地址。这是警告消息中提到的行号。
- 删除包含主机名或 IP 地址的行。在 TextEdit 中同时按下
Control-K 键,以删除与该主机相关的所有身份验证密钥。
- 保存该 TextEdit 文件。
- 退出 TextEdit。
- 在管理计算机上打开 Terminal。
- 键入以下命令:ssh -l root
- 按下 Return(回车)键。这时将提示询问是否要重新创建身份验证。
- 在命令提示符中键入 'y',以重新创建身份验证。
- 这时将出现一个新的指纹,并提示询问是否想要继续执行连接过程。
|