Oh, I missed you were talking about sftp. The problem is that we've mostly focused on the server side, so the client side is still lacking lots of features. And the sftp support is one of them unfortunately.
On Mon, Jan 23, 2012 at 09:48, Guillaume Nodet <[email protected]> wrote: > You can find a real working example of using the client side in Apache Karaf: > https://github.com/apache/karaf/blob/trunk/client/src/main/java/org/apache/karaf/client/Main.java > > The basic idea is to open a channel which is either a "shell" channel > for an interactive session or an "exec" channel to execute a single > command and exit without any user interaction. > The channel has an input stream and two output streams (out and err) > which you can set to redirect to the default System.out and System.err > or to your own in-memory stream or whatever kind of streams you want. > > On Mon, Jan 23, 2012 at 08:16, manoj kumar <[email protected]> wrote: >> 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 >> 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_SHELL); >> 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(); >> >> -- >> Thanks and Regards, >> Manoj Kumar >> 9535214528 > > > > -- > ------------------------ > Guillaume Nodet > ------------------------ > Blog: http://gnodet.blogspot.com/ > ------------------------ > FuseSource, Integration everywhere > http://fusesource.com -- ------------------------ Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ FuseSource, Integration everywhere http://fusesource.com
