我正在尝试使用 c# WinForms 通过 SSH 连接到 Avocent ACS6000。尝试连接到 Windows SSH 服务器 时,以下代码成功。
但它在所需设备上不起作用抛出exception
exception : No suitable authentication method found to complete authentication (publickey,keyboard-interactive)
我找到了以下解决方案,但要么不适合我的问题,要么我不知道如何使用它们。
是否有可能强制Windows默认包含
hmac-sha2-512
参数。所以当我尝试连接时它会一直使用这个算法吗?使用 Putty 它会提示我接受密钥并且它完美无缺。
(使用 Renci.SshNet 的代码)
sshclient = new SshClient(IPadress, port, username, password);
try
{
OutputRichTextBox.AppendText("SSH Conecting..." + Environment.NewLine);
sshclient.Connect();
if (sshclient.IsConnected == true)
{
OutputRichTextBox.AppendText("Connected to Server" + Environment.NewLine);
}
else
{
OutputRichTextBox.AppendText("Ping failed." + Environment.NewLine);
}
}
catch
{
OutputRichTextBox.AppendText("Error : Not Connected" + Environment.NewLine);
}
我首先 使用 ssh [email protected]
将它测试到 Windows Server命令提示符,它连接成功。但对于 Avocent 设备,它 需要
ssh [email protected] -m hmac-sha2-512
命令
当尝试在没有最后一个参数的情况下使用CMD连接时:
C:\Users\User>ssh [email protected]
The authenticity of host 'x.x.x.x (x.x.x.x)' can't be established.
ED25519 key fingerprint is SHA256:(**key**).
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Corrupted MAC on input.
ssh_dispatch_run_fatal: Connection to 10.1.10.47 port 22: message authentication code incorrect