You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Zhuyulei (A)" <zh...@huawei.com> on 2014/12/05 09:17:08 UTC

mina sshd questions

Hi,
I am using mina sshd 0.12.0, but there is little documentation...I have some questions about how to use mina sshd...

I can set up ssh server and use ssh client connecting the ssh server, but now I want to do not only this...

I want to know if mina sshd can do ssh reverse, just like this:
Now I have 2 Linux machines: controller-10-68-168-154 and controller-10-68-168-156
On controller-10-68-168-154:
controller-10-68-168-154:~ # ssh -NfR 9090:localhost:22 controller-10-68-168-156
Password:
controller-10-68-168-154:~ #

On controller-10-68-168-156, I can get 127.0.0.1:9090 listenning:
controller-10-68-168-156:~ # netstat -tnl | grep 127.0.0.1
tcp        0      0 127.0.0.1:9090          0.0.0.0:*               LISTEN
controller-10-68-168-156:~ #
then I can do this to connect controller-10-68-168-154:
controller-10-68-168-156:~ # ssh -p 9090 localhost
Password:
Last login: Fri Dec  5 14:42:05 2014 from 10.135.87.127
controller-10-68-168-154:~ #

Is Mina SSHD sshServer able to do this? How can I implement this with Mina SSHD? Anyone can show me an example? Thanks.

Re: mina sshd questions

Posted by Guillaume Nodet <gn...@apache.org>.
Yes, the Mina SSHD Server supports that.
If you launch the default sshd server from the distribution:
  bin/sshd.sh -p 8000

You can then run
  ssh -NfR 9090:localhost:8000 localhost

and then connect
  ssh -p 9090 localhost

The mina ssh client process (bin/ssh.sh) does not support all those
options, but it does support all that programmatically.

You'll find plenty of port forwarding tests you can have a look at in the
source code:

https://github.com/apache/mina-sshd/blob/master/sshd-core/src/test/java/org/apache/sshd/PortForwardingTest.java



2014-12-05 9:17 GMT+01:00 Zhuyulei (A) <zh...@huawei.com>:

> Hi,
> I am using mina sshd 0.12.0, but there is little documentation...I have
> some questions about how to use mina sshd...
>
> I can set up ssh server and use ssh client connecting the ssh server, but
> now I want to do not only this...
>
> I want to know if mina sshd can do ssh reverse, just like this:
> Now I have 2 Linux machines: controller-10-68-168-154 and
> controller-10-68-168-156
> On controller-10-68-168-154:
> controller-10-68-168-154:~ # ssh -NfR 9090:localhost:22
> controller-10-68-168-156
> Password:
> controller-10-68-168-154:~ #
>
> On controller-10-68-168-156, I can get 127.0.0.1:9090 listenning:
> controller-10-68-168-156:~ # netstat -tnl | grep 127.0.0.1
> tcp        0      0 127.0.0.1:9090          0.0.0.0:*               LISTEN
> controller-10-68-168-156:~ #
> then I can do this to connect controller-10-68-168-154:
> controller-10-68-168-156:~ # ssh -p 9090 localhost
> Password:
> Last login: Fri Dec  5 14:42:05 2014 from 10.135.87.127
> controller-10-68-168-154:~ #
>
> Is Mina SSHD sshServer able to do this? How can I implement this with Mina
> SSHD? Anyone can show me an example? Thanks.
>