You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Влад Сурагин <v....@mail.ru> on 2015/10/19 20:20:44 UTC

SSHD Server

Greetings all,

I'm a little bit confused.
I've created an elementary sshd server*.
Deployed it to openBSD device.
Connected to it through putty, successfully logged in.
And then... nothing.

I mean for every symbol I type I'm getting next info on server ( http://prntscr.com/8t1ol7 )
but nothing happens in putty console (http://prntscr.com/8t1pnk).

Do you have any idea why is it happening?



*
public static void main(String[] args) {
   try {
      SshServer server = SshServer.setUpDefaultServer();
      server.setPort(9081);
      server.setPasswordAuthenticator(new DynamicAuthenticator());
      server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
      server.setShellFactory(new ProcessShellFactory(new String[] { "/bin/ksh" }));
      server.setCommandFactory(new ScpCommandFactory());
      server.start();
   } catch (IOException e) {
      e.printStackTrace();
   }
}

Sincerely yours,
Vlad Suragin

RE: SSHD Server

Posted by Lyor Goldstein <lg...@vmware.com>.
1. The server code is incomplete - after "server.start()" you must have an infinite loop otherwise the "main" program will exit and stop:

	server.start();
	while(...still ok to run...) { Thread.sleep(...); }

2. Are you sure "/bin/ksh" can be run by you ? Remember that your server is running as the current user and not "root"...

3. Make sure you are connecting to SAME port you set the server to listen to (9081 in the example below)

4. If all else fails, you can debug the ProcessShell class and see what happens...

-----Original Message-----
From: Влад Сурагин [mailto:v.suragin@mail.ru] 
Sent: Monday, October 19, 2015 21:21
To: dev@mina.apache.org
Subject: SSHD Server


Greetings all,

I'm a little bit confused.
I've created an elementary sshd server*.
Deployed it to openBSD device.
Connected to it through putty, successfully logged in.
And then... nothing.

I mean for every symbol I type I'm getting next info on server but nothing happens in putty console.

Do you have any idea why is it happening?



*
public static void main(String[] args) {
   try {
      SshServer server = SshServer.setUpDefaultServer();
      server.setPort(9081);
      server.setPasswordAuthenticator(new DynamicAuthenticator());
      server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
      server.setShellFactory(new ProcessShellFactory(new String[] { "/bin/ksh" }));
      server.setCommandFactory(new ScpCommandFactory());
      server.start();
   } catch (IOException e) {
      e.printStackTrace();
   }
}

Sincerely yours,
Vlad Suragin