You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Jorge Martín Cuervo <jo...@martincuervo.com> on 2023/07/07 12:04:58 UTC

How to use CommandFactory

Hello,

I have a working server with a shell implementation and I want to improve
it with a command. I want to use the command to receive parameters in the
shell:

ssh user@server param1 param2

And in both cases open an interactive shell. I have instructed the 2
factories (Command and Shell) to create instances of the same class.
However I see slightly different behaviours. With the console factory it
looks like the commands I input are echoed.

Reading the documentation, there is a mention that the channel types are
different.
https://github.com/apache/mina-sshd/blob/master/docs/server-setup.md

[...]
CommandFactory - The CommandFactory provides the ability to run a *single*
direct command at a time instead of an interactive session (it also uses a
*different* channel type than shells). It can be used *in addition* to the
ShellFactory.
[...]

Could you please explain the different types?

Many thanks!!

Re: How to use CommandFactory

Posted by Jorge Martín Cuervo <jo...@martincuervo.com>.
After a quick investigation, it looks like the differences came from the
client side.
Using openssh client with a command requires the -t option (Force
pseudo-terminal allocation).
Without a command enables this option by default.

On Fri, Jul 7, 2023 at 7:13 PM Jorge Martín Cuervo <jo...@martincuervo.com>
wrote:

> I see that with the shell factory y get this from the ssh client:
>
> debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence
> from console
> debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports
> the ansi parsing
>
> which I dont get with the command factory.
> how can i make the command factory work like the shell factory?
>
>
> On Fri, Jul 7, 2023 at 2:04 PM Jorge Martín Cuervo <jo...@martincuervo.com>
> wrote:
>
>> Hello,
>>
>> I have a working server with a shell implementation and I want to improve
>> it with a command. I want to use the command to receive parameters in the
>> shell:
>>
>> ssh user@server param1 param2
>>
>> And in both cases open an interactive shell. I have instructed the 2
>> factories (Command and Shell) to create instances of the same class.
>> However I see slightly different behaviours. With the console factory it
>> looks like the commands I input are echoed.
>>
>> Reading the documentation, there is a mention that the channel types are
>> different.
>> https://github.com/apache/mina-sshd/blob/master/docs/server-setup.md
>>
>> [...]
>> CommandFactory - The CommandFactory provides the ability to run a
>> *single* direct command at a time instead of an interactive session (it
>> also uses a *different* channel type than shells). It can be used *in
>> addition* to the ShellFactory.
>> [...]
>>
>> Could you please explain the different types?
>>
>> Many thanks!!
>>
>>
>
> --
> ____________________________________
> Jorge Martin Cuervo
>
> email <jo...@martincuervo.com>
> voice 0032 489 336 802
> ____________________________________
>

Re: How to use CommandFactory

Posted by Jorge Martín Cuervo <jo...@martincuervo.com>.
I see that with the shell factory y get this from the ssh client:

debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence
from console
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports
the ansi parsing

which I dont get with the command factory.
how can i make the command factory work like the shell factory?


On Fri, Jul 7, 2023 at 2:04 PM Jorge Martín Cuervo <jo...@martincuervo.com>
wrote:

> Hello,
>
> I have a working server with a shell implementation and I want to improve
> it with a command. I want to use the command to receive parameters in the
> shell:
>
> ssh user@server param1 param2
>
> And in both cases open an interactive shell. I have instructed the 2
> factories (Command and Shell) to create instances of the same class.
> However I see slightly different behaviours. With the console factory it
> looks like the commands I input are echoed.
>
> Reading the documentation, there is a mention that the channel types are
> different.
> https://github.com/apache/mina-sshd/blob/master/docs/server-setup.md
>
> [...]
> CommandFactory - The CommandFactory provides the ability to run a *single*
> direct command at a time instead of an interactive session (it also uses a
> *different* channel type than shells). It can be used *in addition* to
> the ShellFactory.
> [...]
>
> Could you please explain the different types?
>
> Many thanks!!
>
>

-- 
____________________________________
Jorge Martin Cuervo

email <jo...@martincuervo.com>
voice 0032 489 336 802
____________________________________