6

我正在尝试以 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

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

4

1 回答 1

6

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

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

于 2013-07-03T20:06:11.720 回答