>> 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).