vb.net SSHAuthenticationExcetion :找不到合适的身份验证方法来完成身份验证

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17456903/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 14:08:20  来源:igfitidea点击:

SSHAuthenticationExcetion :No suitable authentication method found to complete authentication

vb.netwinformsunixssh

提问by JoSav

I'm trying to connect on a server in vb.net win forms. I put a button and a text area to receive the data. But I'm unable to connect on the server. The server is open because i can ping it.

我正在尝试以 vb.net win 形式连接到服务器上。我放了一个按钮和一个文本区域来接收数据。但是我无法在服务器上连接。服务器是开放的,因为我可以 ping 它。

Private Sub SimpleButton1_Click(sender As System.Object, e As System.EventArgs) Handles SimpleButton1.Click
    Dim PasswordConnection = New PasswordAuthenticationMethod("username", "pass")
    Dim KeyboardInteractive = New KeyboardInteractiveAuthenticationMethod("username")
    Dim ConnectionInfo = New ConnectionInfo("server.com", 22, "username", PasswordConnection, KeyboardInteractive)

    Using client As New SshClient(ConnectionInfo)
        client.Connect()

        Dim cmd As SshCommand
        Dim result As String
        Dim result2 As String

        cmd = client.CreateCommand("who")
        cmd.CommandTimeout = TimeSpan.FromSeconds(10)
        result = cmd.Execute
        result2 = cmd.Error
        MemoEdit1.Text = cmd.ExitStatus

        If String.IsNullOrEmpty(result2) Then
            MemoEdit1.Text = result2
        End If

        MemoEdit1.Text = result

        client.Disconnect()
    End Using
End Sub

Am I doing something wrong?
The program stuck directly on the "client.Connect()". As you can see im trying to connect on the event click of SimpleButton1

难道我做错了什么?
该程序直接停留在“client.Connect()”上。正如您所看到的,我正在尝试连接 SimpleButton1 的事件单击

采纳答案by Steven V

Normally No suitable authentication method found to complete authentication is usedis returned from an SSH server when the server does not allow authentication by the offered methods by the client.

No suitable authentication method found to complete authentication is used当服务器不允许通过客户端提供的方法进行身份验证时,通常从 SSH 服务器返回。

The SSH server could only allow public key authentication, or some form of two factor authentication in turn preventing password authentication. Download an SSH client like Puttyand try to connect to the server directly and see what the result is.

SSH 服务器只能允许公钥身份验证,或某种形式的两因素身份验证反过来阻止密码身份验证。下载一个像Putty这样的SSH客户端,尝试直接连接服务器,看看结果如何。