Mono Support?

Feb 13, 2013 at 3:10 AM
Edited Feb 13, 2013 at 3:19 AM
I see Mono support is listed but I am not able to get this code to execute correct via Mono.

Here is the code I am running:
            using (SshClient ssh = new SshClient(host,username,password))
            {
                try {
                    ssh.Connect();

                    var cmd = ssh.CreateCommand("ls -l");   //  very long list
                    var asynch = cmd.BeginExecute(delegate(IAsyncResult ar)
                                                  {
                        Console.WriteLine("Finished.");
                    }, null);
                    
                    var reader = new StreamReader(cmd.OutputStream);
                    
                    while (!asynch.IsCompleted)
                    {
                        var result = reader.ReadToEnd();
                        if (string.IsNullOrEmpty(result))
                            continue;
                        Console.Write(result);

                    }
                    cmd.EndExecute(asynch);
                }
                catch (Exception ex){
                    Console.WriteLine (ex.Message + Environment.NewLine + ex.StackTrace);

                }
            }
Here are the results:

No suitable authentication method found to complete authentication.
at Renci.SshNet.ConnectionInfo.Authenticate (Renci.SshNet.Session session) [0x0009f] in .../Renci.SshNet/ConnectionInfo.cs:413
at Renci.SshNet.Session.Connect () [0x00322] in .../Renci.SshNet/Session.cs:558
at Renci.SshNet.BaseClient.Connect () [0x0005b] in .../Renci.SshNet/BaseClient.cs:117
at SSH_TEST.MainClass.Main (System.String[] args) [0x0001b] in .../SSH_TEST/Main.cs:21


Has anyone been able to compile and execute the Renci.SshNet solution via MonoDevelop in OSX?

This same code runs just fine in VS2010...
Coordinator
Feb 13, 2013 at 1:43 PM
Hi,

Unfortunatly I wont be able to help you with mono part. I have people who compiled and used it on Mono so may be they will be able to help you with that.
Usually "No suitable authentication method found to complete authentication" message means that you need to use password authentication instead of private key, or private key instead password, may be even keyboard interactive etc'.
I would just try different authentication method and see if it works.

Hope it helps,
Thanks,
Oleg
Feb 14, 2013 at 7:36 PM
Thanks for the Response Oleg.

Is there a way to capture and display the standard error and standard output of the attempted ssh connection? I'm sure if I can see what the error really is I can craft a solutions.

My guess is the ssh session connection attempt is hanging at something like this:
$ ssh 192.168.170.209
The authenticity of host '192.168.170.209 (192.168.170.209)' can't be established.
RSA key fingerprint is 93:2e:4c:3f:d7:33:0f:43:54:1a:35:3e:50:02:06:a4.
Are you sure you want to continue connecting (yes/no)? 
But without a response back from the failed connection attempt I'm just shooting in the dark...

Nathan
Coordinator
Feb 14, 2013 at 7:43 PM
Hi Nathan,
Actually the message that you see its something that client displays, its not part of the protocol, to wait for response.
Did you try to debug it? Where does it hang? What line?
Also, did you try to connect to different server and you have the same behavior everywhere?

Thanks,
Oleg