Skip to content

yanbinjia/jcabi-ssh

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

EO principles respected here Managed by Zerocracy DevOps By Rultor.com

mvn PDD status Maven Central Javadoc codecov

Hits-of-Code Lines of code License

More details are here: ssh.jcabi.com.

Also, read this blog post: Simple Java SSH Client.

It is a convenient SSH client for Java:

import com.jcabi.ssh.Shell;
import com.jcabi.ssh.Ssh;
Shell shell = new Ssh("example.com", 22, "username", "key...");
String stdout = new Shell.Plain(shell).exec("echo 'Hello, world!'");

The key here is your private SSH key, usually the one you have in ~/.ssh/id_rsa.

There is also a convenient SSHD class, a runner of ssh daemon, for unit testing:

try (Sshd sshd = new Sshd()) {
  String uptime = new Shell.Plain(
    Ssh(sshd.host(), sshd.login(), sshd.port(), sshd.key())
  ).exec("uptime");
}

Version 1.6 works under Java 1.8+. If your Java version is ealier, use version 1.5.2.

How to contribute?

Fork the repository, make changes, submit a pull request. We promise to review your changes same day and apply to the master branch, if they look correct.

Please run Maven (3.2+) build before submitting a pull request:

$ mvn clean install -Pqulice

Make sure you have Maven 3.3+ and Java 8+.

Packages

 
 
 

Languages

  • Java 100.0%