lgoldstein commented on issue #103: [1.1.x]question about use mina-sshd as ssh-client and send shell command URL: https://github.com/apache/mina-sshd/pull/103#issuecomment-496257868 Here is sketch of how I would do it (assuming the latest version) - for more details see `SshClientMain` class in the project. ```java SshClient client = SshClient.setUpDefaultClient(); client.start(); while (...keep running...) { try (ClientSession session = client.connect(.....).verify(...timeout...).getSession()) { session.addPasswordIdentity(....); // or addKeyIdentity... session.auth().verify(...timeout...); try (ClientChannel channel = session.createShellChannel(....)) { channel.setIn(new NoCloseInputStream(System.in)); channel.setOut(new NoCloseOutputStream(System.out)); channel.setErr(new NoCloseOutputStream(System.err)); channel.open().verify(....timeout...); // This causes this thread to block until shell is closed... channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), 0L); } } } client.stop(); ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
