SSH 接受密钥,但 SSHFS 不接受

SSH 接受密钥,但 SSHFS 不接受

从我的 Mac,我可以毫无问题地 ssh 到 ubuntu 机器。

钥匙在我的下面~/.ssh/known_hosts

当我尝试通过 sshfs 连接到同一个 IP 时,我得到:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote host is
SHA256:klJ1Y+1p8LdZuhukPrdpIOlolC05sX628n9owaM4DZY.
Please contact your system administrator.
Add correct host key in /var/root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /var/root/.ssh/known_hosts:4
ECDSA host key for xx.xx.xx.xx has changed and you have requested strict checking.
Host key verification failed.
remote host has disconnected

日志中提到的密钥不是我known_hosts为这个 IP 设置的密钥,对吗?

答案1

您正在使用 或 使用sshfs进行 安装,而 则以普通用户身份进行调用。rootsudossh

因此sshfs主机密钥不在~/.ssh/known_hosts,但是/var/root/.ssh/known_hosts

删除该文件的第 4 行,它就可以正常工作:

sudo sed -i '4d' /var/root/.ssh/known_hosts

或者,sshfs以普通用户身份运行,无需sudo

相关内容