Hi Guillaume,
There is no such thing... I will surely use the mailing lists for further
communications.
Long time back I asked for the help regarding the implementation of
sftpclient using apache sshd library...
My plan is to execute sftp commands in sftp subsystem mode.
In my entry class, I have added chunk of code shown below:

                       ClientChannel channel =
session.createSubsystemChannel( "sftp" );
                        InputStream in = new ByteArrayInputStream( 
"ls".getBytes() );
                        channel.setIn(in);
                        channel.setOut(System.out);
                        channel.setErr(System.err);
                        channel.open().await();

And in ChannelSubsystem.java class, below api is provided:

protected void doOpen() throws Exception {
        super.doOpen();
        log.info("Send SSH_MSG_CHANNEL_REQUEST subsystem...");
        Buffer buffer =
session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_REQUEST, 0);
        buffer.putInt(recipient);
        buffer.putString("subsystem");
        buffer.putBoolean(true);
        buffer.putString(subsystem);
        session.writePacket(buffer);
    }


After executing the entry class I got following logs:
2012-04-12 18:25:14,106 [main           ] INFO  ChannelSubsystem              
- Send SSH_MSG_CHANNEL_OPEN on channel 0
2012-04-12 18:25:18,202 [NioProcessor-2 ] INFO  ClientSessionImpl             
- Received SSH_MSG_CHANNEL_OPEN_CONFIRMATION on channel 0
2012-04-12 18:25:18,204 [NioProcessor-2 ] INFO  ChannelSubsystem              
- Send SSH_MSG_CHANNEL_REQUEST subsystem...
2012-04-12 18:25:18,227 [NioProcessor-2 ] INFO  ClientSessionImpl             
- Closing session
2012-04-12 18:25:18,230 [NioProcessor-2 ] INFO  ChannelSubsystem              
- Closing channel 0 immediately


My question here is, why is it closing the session after sending
SSH_MSG_CHANNEL_REQUEST for subsystem?



gnodet wrote:
> 
> Unless there's a need for secrecy, using the mailing lists is usually a
> good idea so that everyone can get involved.
> 
> On Thu, Apr 12, 2012 at 14:47, manojkumar16 <[email protected]>
> wrote:
> 
>>
>> Actually, I do not want to use Jsch library... Since, Apache sshd has
>> provided well-written ssh library for both client and server, I want to
>> focus more on implementing sftp client using apache sshd library.
>> Can you reach me on [email protected] so that I can explain you
>> exactly
>> what I am doing for sftp client implementation using apache sshd library?
>>
>>
>> David Latorre wrote:
>> >
>> > For SFTP-client support there are several options, in our case, we use
>> > apache commons vfs with JSCH libraries. Would that work for you?
>> >
>> >
>> >
>> >
>> > 2012/1/23 Guillaume Nodet <[email protected]>:
>> >> 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
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/sshClient-in-apache-sshd-mina-tp33186423p33675023.html
>> Sent from the Apache MINA User Forum mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com
> 
> 

-- 
View this message in context: 
http://old.nabble.com/sshClient-in-apache-sshd-mina-tp33186423p33675184.html
Sent from the Apache MINA User Forum mailing list archive at Nabble.com.

Reply via email to