【问题标题】:SSHAuthenticationExcetion :No suitable authentication method found to complete authenticationSSHAuthenticationExcetion : 没有找到合适的身份验证方法来完成身份验证
【发布时间】:2023-03-15 19:08:01
【问题描述】:

我正在尝试以 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 的事件点击上连接

【问题讨论】:

  • SSH 服务器是否允许键盘/密码认证?
  • 我以前经常使用此代码,但遇到同样的问题:Using client As New SshClient("server.com", 22, "username", "pass")
  • 我不知道服务器是否分配了那种类型的身份验证...
  • 你可以 ping 任何你喜欢的。问题是,你能 telnet 到 22 端口吗?
  • 当服务器不允许通过客户端提供的方法进行身份验证时,SSH 服务器通常使用No suitable authentication method found to complete authentication。 SSH 服务器只能允许公钥身份验证,或某种形式的两因素身份验证,从而阻止密码身份验证。下载Putty之类的SSH客户端,尝试连接服务器,看看结果如何。

标签: vb.net winforms unix ssh


【解决方案1】:

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

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

【讨论】:

  • 你是我无法使用 telnet 和 putty 连接,因为要求我执行此应用程序的人向我发送了错误的服务器。有了好的服务器,一切正常
猜你喜欢
  • 2016-04-24
  • 2020-03-05
  • 2015-07-10
  • 2021-09-21
  • 2015-07-18
  • 1970-01-01
  • 2010-10-24
  • 1970-01-01
  • 2016-08-04
相关资源
最近更新 更多