我正在使用Renci SSH.NET,在FTP(而不是SFTP站点)上进行测试。
我已经通过WinSCP使其工作-但无法在Renci上使其工作- WinSCP允许我将协议设置为FTP或SFTP-我认为这是问题所在-我被提示
找不到适合的身份验证方法来完成身份验证(publickey,keyboard-interactive)。
如何在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