On Thursday 03 June 2010 12:40:51 Guillaume Nodet wrote:
> Right, but look at http://mina.apache.org/sshd/
> The second sentence of the web site is:
>     "SSHD does not really aim at being a replacement for the SSH
> client or SSH server from Unix operating systems, but rather provides
> support for Java based applications requiring SSH support."
I know that, and I think you're doing a great job!

> 
> That said, I agree we could provide a simple CommandFactory that would
> just run the underlying OS command out of the box.
> 
> Maybe try something like:
> 
>         sshd.setCommandFactory(new ScpCommandFactory(new CommandFactory() {
>             public Command createCommand(String command) {
>                 return new ProcessShellFactory(command.split(" ")).create();
>             }
>         }));
Works like a charm, which make you a magician :)
I suggest you add it to the docs, since it will be forgotten in the list.

Thanks a lot !!!!

> 
> 
> On Thu, Jun 3, 2010 at 11:25, Doron Fediuck <do...@redhat.com> wrote:
> > On Thursday 03 June 2010 12:14:01 Guillaume Nodet wrote:
> >> Not sure to completely understand your problem.
> >> When the client execute a remote command, you need the server to be
> >> able to understand and actually run the command.
> >> If you're sending "ls -l" you need something on the server to handle that.
> >> There is only a single CommandFactory implementation provided, which
> >> is the one for scp support.
> >> If you want to support "ls -l", you need to implement your own
> >> CommandFactory, which could either launch a process to run "ls -l"
> >> (and that would only work on unix) or implement it yourself the way
> >> you want.
> >> Not sure if that's only an example, or if you actually want to run "ls
> >> -l" though ...
> >
> > You're right- it's an example, and I wanted to know if there's an 
> > implementation
> > of shell CommandFactory ? It seems to be the case in standard Linux sshd.
> > IE- if I open an exec channel to a Linux based SSH server I can simply
> > run 'ls -l ' and get the response without the need to open a shell channel.
> >
> >>
> >> On Thu, Jun 3, 2010 at 11:06, Doron Fediuck <do...@redhat.com> wrote:
> >> > Hi,
> >> > I tried setting up a server using your 5-minute guide.
> >> > This server has-
> >> > sshd.setCommandFactory(new ScpCommandFactory());
> >> >
> >> > The problem is, that my client code runs:
> >> > channel = session.createExecChannel("ls -l");
> >> >
> >> > And this is not supported by ScpCommandFactory (took me a lot of
> >> > debug to get the error message "Unknown command, does not begin with 
> >> > 'scp'"
> >> > this has to be better logged!).
> >> >
> >> > When my client code tuns on standard Linux sshd it works perfectly,
> >> > how can I support it with mina sshd server code without changing
> >> > the client side?
> >> >
> >> > Thanks,
> >> > Doron
> >> >
> >>
> >>
> >>
> >>
> >
> 
> 
> 
> 

Reply via email to