Class SshUtils

java.lang.Object
org.ndviet.library.ssh.SshUtils

public final class SshUtils extends Object
Example utility to use SSH via Apache Mina SSHD
Author:
Drew Thorstensen
  • Method Details

    • runCommand

      public static SshResponse runCommand(SshConnection conn, String cmd, long timeout) throws SshTimeoutException, IOException
      Runs a SSH command against a remote system.
      Parameters:
      conn - Defines the connection to the system.
      cmd - The command to run. Should generally be fully qualified (ex. instead of 'ls -la', use '/bin/ls -la')
      timeout - The amount of time to wait for the command to run before timing out. This is in seconds. This is used as two separate timeouts, one for login another for command execution.
      Returns:
      The SshResponse contains the output of a successful command.
      Throws:
      SshTimeoutException - Raised if the command times out.
      IOException - Raised in the event of a general failure (wrong authentication or something of that nature).
    • join

      public static String join(List<String> status)