Package com.jcabi.ssh

Class Ssh

  • All Implemented Interfaces:

    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,,, exec()}:

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

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

    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)