且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

连接到SFTP服务器时使用SharpSSH指纹

更新时间:2023-02-07 20:59:05

SharpSSH非常愚蠢,无法默认验证主机密钥.

The SharpSSH is stupid enough not to verify the host keys by default.

您将不得不重新实现SshBase.ConnectSession而不是将StrictHostKeyChecking设置为no.

You would have to re-implement SshBase.ConnectSession not to set StrictHostKeyChecking to no.

  • 然后使用JSch.getHostKeyRepository().add()配置所需的主机密钥(或实现HostKeyRepository接口).
  • 或实现UserInfo接口,尤其是promptYesNo方法.
  • And then use JSch.getHostKeyRepository().add() to configure expected host key (or implement HostKeyRepository interface).
  • Or implement UserInfo interface, particularly the promptYesNo method.