Skip to content

jcabi/jcabi-ssh

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 jpeek report License Codacy Badge

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+.