Java - Interacting with an SSH Session

I am currently creating a Java learning application. I am trying to connect to my server via SSH, do some things and get what the system gives me. I am using jcabi-ssh for my SSH management.

Currently, I can use SSH on the server and execute standard commands.

I execute the following commands:

new Shell.Plain(sshpw).exec(cmd);

Where "sshpw" is the SSHByPassword object.

Now I read that I can execute commands using the method of the object itself, and not using the shell. Since the documents indicate that only the first parameter is used for this command, and I tried the following three for logging:

sshpw.exec(cmd, System.in, System.out, System.err);

But there is no difference in output (no).

Any tips on what I need to read? Working with external libraries is so sorry for me, so I skipped some important documents.

+4
source share

Source: https://habr.com/ru/post/1659360/


All Articles