Hi All,

I have a diferent problem now

I want to use the scpclient tp upload and download files

Is there a way to upload and download as a different user

e.g connect as user A and upload as user B using different passwords

Please let me know

Thanks

Prajwal


On 10/16/2019 9:12 PM, Prajwal M 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