Class SimpleConsoleSshServer

java.lang.Object
org.dellroad.jct.ssh.simple.SimpleConsoleSshServer
All Implemented Interfaces:
Closeable, AutoCloseable

public class SimpleConsoleSshServer extends Object implements Closeable
A simple SSH server exposing a Shell and/or and Exec.

The only supported authentication type is public key authentication.

Instances must be start()'ed before use and should be stop()'ed when no longer needed.

  • Field Details

    • log

      protected final org.slf4j.Logger log
    • exec

      protected final Exec exec
    • shell

      protected final Shell shell
    • listenPort

      protected final int listenPort
    • loopbackOnly

      protected final boolean loopbackOnly
    • authenticator

      protected final org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator authenticator
    • hostKeyProvider

      protected final org.apache.sshd.common.keyprovider.KeyPairProvider hostKeyProvider
    • sshd

      protected org.apache.sshd.server.SshServer sshd
  • Constructor Details

  • Method Details

    • builder

      public static SimpleConsoleSshServer.Builder builder()
      Create an instance builder.
      Returns:
      new instance builder
    • start

      public void start() throws IOException
      Start this instance.

      Does nothing if already started.

      Throws:
      IOException - if an I/O error occurs setting up the listen socket
    • stop

      public void stop()
      Stop this instance.
    • close

      public void close()
      Close this instance.

      Delegates to stop().

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable