Thank you ever so much for that.  I believe it has pushed me into the right
direction.

I was hoping to tell you that I have succeeded, but unfortunately, I've ran
into an issue whereby my SSHD cannot bind to any port!  This is on Windows
10 with 2.2.0 libraries - I'm very familiar with checking which ports are
in use and killing the responsible PIDs etc, but at the moment, I'm not
seeing any evidence of a port in use (netstat doesn't show anything for
these ports), other than it complaining about failing to bind as the port
is in use.

I don't believe I have broken anything in my code as I took it back to
basics and I get the same error.

Have you by chance ever seen this issue before?  I don't believe for one
moment it is the mina-sshd code - more likely a Windows update as I don't
understand how it fails even if I change ports (but then nothing shows that
the port is in use).
Hopefully it is something obvious that I'll spot soon.

Anyway, thank you for your help.

I'll try get my code onto another machine at least and see if I can get
past this issue!

Thanks again for your help.  If I manage to try it properly, I'll update on
whether I managed to get it to work.
Thanks,
Adam.

On Thu, 2 May 2019 at 18:17, Lyor Goldstein <[email protected]> wrote:

> >>  I am embedding the SSHD server and I want to only allow certain users
> to request a shell - for other users, I want it to deny the request as
> if I hadn't
> configured a ShellFactory.
>
> Strangely enough you seem  to be right - there is no simple straightforward
> way to achieve this (I have opened an issue to make it easier). Here is how
> you can do this for now:
>
> * Register a ShellFactory instance with the SSH server:
>
> server = SshServer.setupDefaultServer();
> server.setShellFactory(new MySpecialFactory());
> ...more configuration...
>
> * Make this instance return an implementation of a Command that also
> implements SessionAware. This will cause the wrapping code to provide you
> with the session instance through which this shell is being created -
> remember this session in your shell "command" instance
>
> * When Command.start(....) is called, examine the previous stored session
> and decide whether you wish to honour the request, If not,then throw an
> exception
>
> Here is the gist if it - there are still a few issues for you to figure out
> - e.g. (perhaps) how to re-use the built-in InteractiveProcessShellFactory
> and wrap it to do what you want (should be fairly simple).
>

Reply via email to