Visual C++ authentication error.

Jun 26, 2015 at 12:01 PM
Greetings to You!

I have a problem with remote command execution through Renci::SshNet namespace.

Here is the code:
PasswordAuthenticationMethod^ pam = gcnew PasswordAuthenticationMethod("username", "password");
            KeyboardInteractiveAuthenticationMethod^ kiam = gcnew KeyboardInteractiveAuthenticationMethod("username");
            
            System::String^ myData = "";

            ConnectionInfo^ ci = gcnew ConnectionInfo("hostname", 22, "username", pam);

            /*
            using (SshClient^ ssh = gcnew SshClient(ci))
            {
                ssh.Connect();
            }
            */

            SshClient^ ssh = gcnew SshClient(ci);
            ssh->Connect();
            //ssh->RunCommand^ cmd = 
            //auto^ command = ssh->RunCommand("uname -a");
            myData = Convert::ToString(ssh->RunCommand("uname -a")->Result);
            
            this->textBox1->Text = myData;

            ssh->Disconnect();
And the error is: An unhandled exception of type 'Renci.SshNet.Common.SshAuthenticationException' occurred in Renci.SshNet.dll

Additional information: No suitable authentication method found to complete authentication (publickey,keyboard-interactive)


Please tell me what I do wrong? :-) Please help me with that!

Thanks in advance!