Hi Prajwal,

Did you see and try something like this?

https://mina.apache.org/sshd-project/tips.html

---
*Thanks & Regards*,
Vijay Shanker |*Software Architect*


On Wed, Oct 16, 2019 at 9:15 PM Prajwal M <[email protected]> wrote:

> Hi All,
>
> I am currently trying to migrate from JSCH to MINA sshd api's
>
> Can you guys please let me know if there is any documentation about how
> to migrate to MINA (mapping jsch to MINA api's)
>
>
> As of now I am trying to execute a simple command /bin/uname and get its
> out put
>
> as below
>
>   try (ChannelExec channel = session.createExecChannel(command)){
>    Trace.out("opening the exec channel");
>                channel.open().awaitUninterruptibly();
> //channel.setStreaming(ClientChannel.Streaming.Sync);
>                Trace.out("Streaming : " +
> channel.getStreaming().toString());
>
>                 InputStream in = channel.getInvertedOut();
> <------------------------------------ get some object for which buffer
> is never ready
>                 InputStreamReader inStream = new InputStreamReader(in);
>               BufferedReader bufReader = new BufferedReader (inStream);
>                  boolean isBufReady = bufReader.ready();
> <----------------------------------------- buffer is never ready
>                 if (isBufReady)
>                      {
>                         thisLine = bufReader.readLine();
>                         if ((thisLine != null) && (!"".equals(thisLine)))
>                            Trace.out ("read line is " + thisLine);
>                            }
>
>                }
>
>
> But I am unable to get the output in any of the streams getInvertedOut
> and getIn
>
> getIn always returns null
>
>
> The purpose here is that we should be able to handle the cases
>
> 1] normal command execution and get the output
>
> 2] If the command propmts for a password we should be able to write it
> and then get the output.
>
> 3] execute with key based authentication.
>
>
> Please throw dome light on how to handle the Input and output streams
> while using the MINSA sshd API's
>
> Speedy response would be appreciated.
>
> Thanks
>
> Prajwal
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to