24.03.2019

SCP and SSH utility written in Java

This is an alternative for native ssh and scp utils. These could be helpful when:

  • Using different private key than in ~/.ssh
  • Private key hasn't acceptable permission - native clients are strict which can be problem especially when running as different user.
  • Unable to pass password when not using authentication by certificate but rather by username/password pair.

Utilities use sshj library.

sshutil

Download: sshutil.jar

usage: java -jar sshutil.jar <OPTIONS> <[username@]HOST> <COMMAND>
 -c <arg>    Charset. When not populated the default charset of you system
             will be used.
 -h          This help
 -i <arg>    A file from which the identity key (private key) for public
             key authentication is read.
 -l <arg>    Username
 -p <arg>    Port to connect to on the remote host.
 -pw <arg>   Passphrase for private key or password for username
 -ta <arg>   Activity timeout [ms] - input stream is cut when inactivity
             longer then this timeout. Note - the result exit code is not
             guaranteed and may be even undefined
 -tolerant   When used the command exit code <> 0 will be propagated as 0
 -tw <arg>   Whole timeout [ms] - input stream is cut when communication
             is longer than this timeout. Note - the result exit code is
             not guaranteed and may be even undefined

scputil

Download: scputil.jar

usage: java -jar scputil.jar <OPTIONS> <[username@]HOST>:/from/path/file
            /to/path/[file]
 -h          This help
 -i <arg>    A file from which the identity key (private key) for public
             key authentication is read.
 -l <arg>    Username
 -p <arg>    Port to connect to on the remote host.
 -pw <arg>   Passphrase for private key or password for username
 -tolerant   When used the command exit code <> 0 will be propagated as 0
usage: java -jar scputil.jar <OPTIONS> /from/path/[file]
            <[username@]HOST>:/to/path/[file]
 -h          This help
 -i <arg>    A file from which the identity key (private key) for public
             key authentication is read.
 -l <arg>    Username
 -p <arg>    Port to connect to on the remote host.
 -pw <arg>   Passphrase for private key or password for username
 -tolerant   When used the command exit code <> 0 will be propagated as 0