Hi,
I want to write sftp Client using apache-sshd mina client api. I am able to
connect to sftp server using apache ssh client but I do not have any idea
how to send sftp command to apache sshd server and how do I get result of
sftp client. I am totally lost. Please guide me. I have confusion on
below *highlighted
code*:
SshClient client = SshClient.setUpDefaultClient();
client.start();
ClientSession session = client.connect("localhost",
port).await().getSession();
session.authPassword("smx", "smx");
ClientChannel channel =
session.createChannel(ClientChannel.CHANNEL_EXEC, "ls");
* ByteArrayOutputStream sent = new ByteArrayOutputStream();*
* PipedOutputStream pipedIn = new TeePipedOutputStream(sent);*
* channel.setIn(new PipedInputStream(pipedIn));*
* ByteArrayOutputStream out = new ByteArrayOutputStream();*
* ByteArrayOutputStream err = new ByteArrayOutputStream();*
* channel.setOut(out);*
* channel.setErr(err);*
* channel.open().await();*
What I understood from the code is, we are using outstream to send sftp
command in the form of byte array to sftp server over a channel.
How do I receive response from sftpserver?
If It is not correct way to send sftp command then what is the correct way
to execute sftp command?
Can anybody provide a simple example which sends sftp command and receives
response from sftp server?
--
Thanks and Regards,
Manoj Kumar
9535214528