mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manoj kumar <manojkuma...@gmail.com>
Subject Fwd: How to execute sftp client using apache ssh client
Date Mon, 23 Jan 2012 14:01:19 GMT
Hi Guillaume,

Thanks for the quick reply.

As you mentioned, "client side is still lacking lots of features. And the
sftp support is one of them unfortunately."
Does it means that creation of sftp subsystem channel is not supported?
Can you please provide a list of features which is missing at sftp client
side?

I followed the link
https://github.com/apache/karaf/blob/trunk/client/src/main/java/org/apache/karaf/client/Main.java
and
I am able to connect the client to sftp server either in "shell" or "exec"
channel. However, it fails when I try to create sftp "subsystem" channel.
Does apache sshd-client supports sftp subsystem?

Is there any documentation available for apache sshd client? I am
struggling hard to understand the behavior and working style of apache sshd
client.


---------- Forwarded message ----------
From: manoj kumar <manojkumar16@gmail.com>
Date: Mon, Jan 23, 2012 at 2:22 PM
Subject: How to execute sftp client using apache ssh client
To: dev@mina.apache.org


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 *taken from SshClient.java:

        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



-- 
Thanks and Regards,
Manoj Kumar
9535214528

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message