Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/guybedo/sshtools

Java SSH tools - easier SSH & SFTP in Java
https://github.com/guybedo/sshtools

java java-8 sftp sftp-client ssh ssh-client

Last synced: 4 days ago
JSON representation

Java SSH tools - easier SSH & SFTP in Java

Awesome Lists containing this project

README

        

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

```xml

com.akalea
ssh-tools
0.2.0

```

Usage
-----

**Setup your SSH connection**:

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

**Delete a file**:

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

**Execute shell commands**:

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

**SFTP**:

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

**OTHER EXAMPLES**:

You can find examples here: [Examples](http://github.com/guybedo/sshtools/tree/master/src/main/java/com/akalea/sshtools/example)