Simple SSH Tunnel in Java

主宰稳场 提交于 2019-11-28 04:46:18

Well, as pointed out in the other question, JSch is indeed a great choice and has several examples here. The PortForwardingL.java class might be a good starting point.

You can do this with several libraries. My favorite is the ssh library inside MindTerm package,

http://linuxmafia.com/pub/java/ISNetworks-MindTerm-1.2.1-SCP3.tar.gz

You can open a tunneled connection like this,

  SSHSocketFactory fact = new SSHSocketFactory(sshHost, sshPort, new SSHPasswordAuthenticator(sshUser, sshPassword));

  sock = fact.createSocket(host, port);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!