Package com.jcabi.ssh

Class Ssh

  • All Implemented Interfaces:
    Shell

    public final class Ssh
    extends Object
    Single SSH Channel.

    This class implements Shell interface. In order to use it, just make an instance and call Shell.exec(String, java.io.InputStream, java.io.OutputStream, java.io.OutputStream) exec()}:

     String hello = new Shell.Plain(
       new SSH(
         "ssh.example.com", 22,
         "yegor", "-----BEGIN RSA PRIVATE KEY-----..."
       )
     ).exec("echo 'Hello, world!'");

    It is highly recommended to use classes from Shell interface, they will simplify operations.

    Since:
    1.0
    See Also:
    article by Yegor Bugayenko
    To do:
    #30:30min Refactor this class into smaller ones to avoid null checking of passphrase. There should probably be separate classes for encrypted/unencrypted private key.
    Suppressed Checkstyle violations:
    ClassDataAbstractionCouplingCheck (500 lines)