Git Product home page Git Product logo

java-ssh-wrapper's Introduction

##Java ssh wrapper

This library is a wrapper around the JSch library

As JSch library is quite painful to use directly, we have developed here a wrapping API above JSch to ease the integration and usage of ssh connexions in a java environment.

Today the following features are supported:

  • check if we can connect to a remote SSH host
  • execute a command on a remote SSH host
  • copy a file to a remote SSH host

Build it

The library is not published on maven central yet.

To build it, just run: ./gradlew fatJar

Use it from the command line

You can play directly with the built jar on the command line (wich is executable), so for instance to get the help:

$ java -jar build/libs/java-ssh-wrapper.jar 
You provided 0 arguments

USAGE: COMMAND user password remotehost [options]
        where COMMAND is 'SCP' (copy from local to remote host) or 'EXEC' (execute a command on remote host) or 'CONNECTED' (test connection to remote host)
        and [options] is 'sourceFileName destFileName' in SCP mode
        or  [options] is "ssh command to launch on remote host" in EXEC mode

To test if you can connect to a host:

$ java -jar build/libs/java-ssh-wrapper.jar CONNECTED guest password localhost
OK :)

To launch a command on a host:

$ java -jar build/libs/java-ssh-wrapper.jar EXEC guest password localhost uname
Linux
Command executed successfully
OK :)

To copy a file to a host:

$ java -jar build/libs/java-ssh-wrapper.jar SCP guest password localhost README.MD DEST_README.MD

Use it as a library in your application

Just grab the jar file and add it to your project. Have a look at the Launcher class (command line launcher) to understand how to use it, I know it is a bit rude, but it is a good simple example.

License

Java ssh wrapper is distributed under the terms of the BSD license, see the license file

java-ssh-wrapper's People

Contributors

christophemaldivi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.