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;
        }
Tornado726
  • 352
  • 1
  • 7
  • 16
  • You have to provide authentication method. [See here](https://stackoverflow.com/a/41535271/1390548) – Jawad Dec 30 '20 at 05:07
  • I'm not sure, but I think you should specify the authentication method: var methods = new List(); methods.Add(new PasswordAuthenticationMethod(UserName, PassWord); var con = new ConnectionInfo(RemoteHost, Port, UserName, methods.ToArray()); using (var client = new SftpClient(con)) { client.Connect(); } – Alenros Dec 30 '20 at 05:17
  • you can see the usage in the documentation for the library: https://github.com/sshnet/SSH.NET/#usage – Alenros Dec 30 '20 at 05:26

1 Answers1

-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.

Tornado726
  • 352
  • 1
  • 7
  • 16
  • What does Plink allow you do to that SSH.NET does not? – Martin Prikryl Jan 01 '21 at 08:26
  • It allows me to log in to the iDRAC without issues. The iDRAC is not much more than a mini version of linux, but it is pretty much impossible to access the underlying OS and change settings, such as the sshd_config file. – Tornado726 Jan 02 '21 at 06:22
  • What *"issues"* do you have with SSH.NET? Did you see my comment above? Haven't it resolved your *"issue"*? – Martin Prikryl Jan 02 '21 at 09:56