【发布时间】:2016-06-13 14:44:29
【问题描述】:
我正在使用 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
【问题讨论】: