Skip to content

guybedo/sshtools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sshtools

Java SSH tools - easier SSH & SFTP in Java

Sshtools is a wrapper around http://www.jcraft.com/jsch/.

The goal is to make it easier to do SSH & SFTP in Java, as using Jsch can be tricky.

Getting Started

Maven

<dependency>
    <groupId>com.akalea</groupId>
    <artifactId>ssh-tools</artifactId>
    <version>0.2.0</version>
</dependency>

Usage

Setup your SSH connection:

SshServerInfo serverInfo =
    new SshServerInfo(
        "login",
        "localhost",
        "/home/user/.ssh/id_rsa",
        null);

Delete a file:

Ssh
	.of(serverInfo)
	.file()
	.deleteFile("/home/user/test.txt");

Execute shell commands:

Ssh
    .of(serverInfo)
    .command()
    .execute(commands);

SFTP:

Ssh
	.of(serverInfo)
	.sftp()
	.execute(
	    Lists.newArrayList(
	        SftpCommand.put(localFile, remoteFile),
	        SftpCommand.get(remoteFile, downloadedFile)));

OTHER EXAMPLES:

You can find examples here: Examples

About

Java SSH tools - easier SSH & SFTP in Java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages