我想在vb.net中獲勝的形式在服務器上連接沒有合適的身份驗證方法。我放了一個按鈕和一個文本區域來接收數據。但我無法在服務器上連接。服務器是開放的,因爲我可以ping它。SSHAuthenticationExcetion:發現完成認證
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服務器允許鍵盤/密碼認證? –
我ussualy使用在此之前的代碼,但有相同的問題:使用客戶端作爲新SshClient(「server.com」,22,「用戶名」,「合格」) – JoSav
我不知道如果服務器allor該類型的身份驗證... – JoSav