zl程序教程

您现在的位置是:首页 >  后端

当前栏目

Ubuntu下,ssh localhost报错:The authenticity of host ‘127.0.0.1 (127.0.0.1)‘ can‘t be established.

sshUbuntu 报错 The of be can Host
2023-09-14 09:09:33 时间

一、问题描述

Ubuntu下,ssh localhost报错如下

The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ED25519 key fingerprint is SHA256:T0nKNOT4ueAZPWVOkqzxsUw6nomrfL40h71s/zz9mQc.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?

二、问题分析

密码未匹配

三、解决方案

方案一:

修改配置文件/etc/ssh/ssh_config

 sudo vim /etc/ssh/ssh_config

修改项如下

#   StrictHostKeyChecking ask
   StrictHostKeyChecking no
#   UserKnownHostsFile ~/.ssh/known_hosts.d/%k
   UserKnownHostsFile /dev/null

方案二(优选):

使用ssh-keygen命令清除连接的remote。

ms@ubuntu:~$ ssh-keygen -R localhost
# Host moshui.fun found: line 1
/home/ms/.ssh/known_hosts updated.
Original contents retained as /home/ms/.ssh/known_hosts.old
ms@ubuntu:~$