我正在使用 Renci SSH.NET,但尝试在 FTP(不是 SFTP 站点)上进行测试。
我确实让这个与 WinSCP 一起工作 - 但无法让它在 Renci 上工作 - WinSCP 允许我将协议设置为 FTP 或 SFTP - 我认为这是问题 - 我被提示
找不到合适的身份验证方法来完成身份验证(公钥、键盘交互)。
如何在 Renci SSH.NET 上关闭 SFTP(仅使用 FTP)?我试过
Dim c As Renci.SshNet.SftpClient / ScpClient/ BaseClient / NetConfClient
这是代码:
Private Sub LancerUpload()
Dim PWAuthMeth = New PasswordAuthenticationMethod(Login, Password)
Dim KIAuthMeth = New KeyboardInteractiveAuthenticationMethod(Login)
AddHandler KIAuthMeth.AuthenticationPrompt, AddressOf HandleKeyEvent
Dim ConnectionInfo As New ConnectionInfo(ServerName, 22, Login, PWAuthMeth, KIAuthMeth)
Dim SshClient1 As New SshClient(ConnectionInfo)
Try
SshClient1.Connect()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
MsgBox(SshClient1.IsConnected)
End Sub
Private Sub HandleKeyEvent(sender As Object, e As Renci.SshNet.Common.AuthenticationPromptEventArgs)
For Each prompt As Renci.SshNet.Common.AuthenticationPrompt In e.Prompts
If prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) <> -1 Then
prompt.Response = Password
End If
Next
End Sub