2016-03-01 73 views
3

我正在使用Renci SSH.NET,但试图在FTP(而不是SFTP站点)上测试。是否可以在Renci SSH.NET上正常工作(不是SFTP)FTP? - 要使用哪个客户端?

我没有得到使用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 

回答

相关问题