【问题标题】:Renci.SshNet can not connect due to errorRenci.SshNet由于错误无法连接
【发布时间】:2019-11-05 04:52:37
【问题描述】:

我有以下简单的代码,但是它不起作用:

Imports Renci.SshNet

Public Class ClassTriggerSender

    Public Sub SendTrigger()

        Dim connInfo As New Renci.SshNet.PasswordConnectionInfo("172.20.47.72", "developer", "developer")

        Dim sshClient As New Renci.SshNet.SshClient(connInfo)

        Dim cmd As Renci.SshNet.SshCommand

        sshClient.Connect()

        cmd = sshClient.RunCommand("dir")

        Console.WriteLine(cmd.Result)

        sshClient.Disconnect()

    End Sub

End Class

我的目标是简单地发送 SSH 命令以在 linux shell 上执行命令。

这是错误信息:

我在堆栈溢出时发现了这个:Renci.sshnet : No suitable authentication method found to complete authentication (publickey,keyboard-interactive) in Vb.net

但是使用此代码,我得到一个类似的错误:

请帮忙。

谢谢!

【问题讨论】:

  • 向我们展示来自任何能够使用相同凭据进行身份验证的 SSH 客户端的日志文件。

标签: vb.net ssh ssh.net


【解决方案1】:

对我来说这是一种工作方法

Dim ssh As Renci.SshNet.SshClient
ssh = New SshClient(host, port, username, password)
    Try
        ssh.Connect()
        ssh.RunCommand(script)
    Catch ex As Exception

    End Try

【讨论】:

    猜你喜欢
    • 2021-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-15
    • 2013-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多