Quantcast
Viewing all articles
Browse latest Browse all 1729

New Post: Create an SSH tunnel

I did this :
using (var client = new SshClient("remote.com", "username", "password"))
{
         client.Connect();
         var port = new ForwardedPortLocal("localhost", 1080, "remote.com", 1080);
         client.AddForwardedPort(port);
         port.Exception += delegate(object sender, ExceptionEventArgs e)
         {
                 Console.WriteLine(e.Exception.ToString());
         };
         port.Start();
}
Console.ReadKey();
I can send commands like if I am connected to a server in ssh (commands like ls, pwd, mkdir etc) but I can't use the tunnel as a SOCKS proxy in openvpn.
The command
ssh -NfD 1080 username@remote.com
works, but not the C# application, and I don't understand why

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>