How to use SSH Library?

Nov 2, 2012 at 10:53 AM

Dear Friends,

I am am new to this area.

I am trying to connect to UNIX server (SSH protocol) from C# (VS 2008 project) and using Renci.SshNet.dll from codeplex portal.

I have few queries as below

1) are API classes provided in Renci.SshNet.dll sufficient to connect and execute command?

2) Source Code is provided on codeplex for SSH. Do we need use the classes from this code as base classes and come up with our own implementation?

Below given is simple code I tried....but giving error as "Method not found..."

 private void ssh()
        {

            try
            {
               
                SshClient objClient = new SshClient(IP Address, User Id, Password);
                objClient.Connect();

                if (objClient.IsConnected)
                {
                    var cmd = objClient.RunCommand("ls");
                }
            }
            catch (Exception ex)
            {
                string str = ex.ToString();
            }
        }

Error description is as below

{System.MissingMethodException: Method not found: 'Int32 System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[], System.TimeSpan)'.
   at Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle)
   at Renci.SshNet.Session.Connect()
   at Renci.SshNet.BaseClient.Connect()
   at Test.Form1.ssh() in D:\Test_1\Test\Form1.cs:line 155}

 

Regards,
Amol Ravatale