This project is read-only.

How can I enable authentication fowarding

Jul 3, 2013 at 12:06 AM
Is it possible to allow authentication forwarding like OpenSSH?
Thanks,
Jul 12, 2013 at 10:35 PM
Edited Jul 12, 2013 at 10:37 PM
Found the answer posted by da_rinkes in the topic RunCommand() doesn't work? .

Port forwarding is the key. The pseudo code example provided by da_rinkes (reposted below) worked almost verbatim.
 using (var client = new SshClient("192.168.1.10", "root", "magic!0n3"))
            {
                client.Connect();

                // foward remote ssh port to your local machine
                ForwardedPortLocal forwarding =  new ForwardedPortLocal("127.0.0.1", "12345", "192.168.1.11", "22");
                client.AddForwardedPort(forwarding);
                forwarding.Start();

                // connect to it
                SshClient forwardedSsh = new SshClient("127.0.0.1", 12345, "root", "password/key");
                forwardedSsh.Connect();

                // run your commands
                MessageBox.Show(forwardedSsh.RunCommand("ls").Result);
            }