C# Error using ssh.net to retrieve data from SSH server

0

I keep getting the following error when I try to connect to an SSH server (in this case the SSH server is the iDRAC on a Dell server):

Renci.SshNet.Common.SshAuthenticationException
  HResult=0x80131500
  Message=No suitable authentication method found to complete authentication (publickey,keyboard-interactive).

Everything I have found references SCP, but I am not using SCP as I am not downloading a file. I need to run a command on the iDRAC to get the system event log and display it in a textbox. The code below is called by a button event handler (further down):

public string ConnectSSH(string RemoteHost, string UserName, string PassWord, string sshCommand, out string ServerResponse)
        {            
            using (var client = new SshClient(RemoteHost, 22, UserName, PassWord))
            {                
                client.Connect();
                var cmd = client.CreateCommand(sshCommand);
                var asyncResult = cmd.BeginExecute();
                var outputReader = new StreamReader(cmd.OutputStream);
                string output;
                while (!asyncResult.IsCompleted)
                {
                    output = outputReader.ReadToEnd();
                    ServerResponse = output;
                }
                output = outputReader.ReadToEnd();
                ServerResponse = output;
                client.Disconnect();
                return ServerResponse;                
            }
        }

And the button event handler code:

private void BtnGetSel_Click(object sender, EventArgs e)
        {
            RemoteHost = TxtHostName.Text;
            UserName = TxtUserName.Text;
            PassWord = TxtPassWord.Text;
            SshCommand = "racadm getsel -E";
            ConnectSSH(RemoteHost, UserName, PassWord, SshCommand, out ServerResponse);
            LblServerResponse.Text = ServerResponse;
        }
c#
ssh.net
asked on Stack Overflow Dec 30, 2020 by Tornado726

1 Answer

-1

Due to limitations of the iDRAC CLI, I resorted to using plink.exe (part of PuTTY) to connect to it via SSH. I think the issue is that you can't modify the sshd_config files on the iDRAC (they lock it down so you can't access the underlying filesystem for security reasons). Plink allows me to do what I want, but PuTTY will need to be part of the installation process of the application.

answered on Stack Overflow Dec 31, 2020 by Tornado726

User contributions licensed under CC BY-SA 3.0