ssh远程主机标识已更改,无法修改ssh密钥

时间:2019-01-07 02:29:39

标签: macos ssh verification

我有一台MacBook,但由于错误,我尝试为GitHub设置pas无字ssh访问权限,并且肯定搞砸了。我是Mac的新手,我不知道如何解决以下问题。

当我尝试建立ssh连接时,得到以下信息

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 RSA key sent by the remote host is
SHA256:DrvZ0osXO8YCnPwEaWyiGKf/SxQGcCZBoNcPrhEdKmI.
Please contact your system administrator.
Add correct host key in /Users/rakeshravi/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/rakeshravi/.ssh/known_hosts:4
RSA host key for rivanna.hpc.virginia.edu has changed and you have requested strict checking.
lost connection

根据我在在线论坛上发现的内容,我正在尝试以下命令,但是 无济于事。

ssh-keygen -R hostname

我得到以下答复。

do_known_hosts: hostkeys_foreach failed: No such file or directory

2 个答案:

答案 0 :(得分:0)

您可以使用自己喜欢的编辑器文件/Users/rakeshravi/.ssh/known_hosts打开并删除第4行并保存该文件。下次您尝试连接到主机时,系统将要求您将新密钥添加到known_hosts

答案 1 :(得分:0)

添加选项 -o "StrictHostKeyChecking no"。这将禁止任何检查。示例:

    ssh root@localhost -o "StrictHostKeyChecking no"