sssh

A Simple scala ssh library

License

License

Categories

Categories

IDE Development Tools
GroupId

GroupId

com.github.mideo
ArtifactId

ArtifactId

sssh_2.11
Last Version

Last Version

0.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

sssh
A Simple scala ssh library
Project URL

Project URL

https://github.com/MideO/sssh
Project Organization

Project Organization

com.github.mideo
Source Code Management

Source Code Management

https://github.com/MideO/sssh

Download sssh_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.mideo/sssh_2.11/ -->
<dependency>
    <groupId>com.github.mideo</groupId>
    <artifactId>sssh_2.11</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.mideo/sssh_2.11/
implementation 'com.github.mideo:sssh_2.11:0.0.2'
// https://jarcasting.com/artifacts/com.github.mideo/sssh_2.11/
implementation ("com.github.mideo:sssh_2.11:0.0.2")
'com.github.mideo:sssh_2.11:jar:0.0.2'
<dependency org="com.github.mideo" name="sssh_2.11" rev="0.0.2">
  <artifact name="sssh_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.mideo', module='sssh_2.11', version='0.0.2')
)
libraryDependencies += "com.github.mideo" % "sssh_2.11" % "0.0.2"
[com.github.mideo/sssh_2.11 "0.0.2"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.8
com.jcraft : jsch jar 0.1.54
com.typesafe : config jar 1.2.1

test (2)

Group / Artifact Type Version
org.scalatest : scalatest_2.11 jar 3.0.3
org.mockito : mockito-all jar 1.9.5

Project Modules

There are no modules declared in this project.

sssh

Build Status

Maven Central

A Simple scala ssh library

import java.io.InputStream
import com.typesafe.config.ConfigFactory

object main extends App {
 //Create credentials from config
  val configString =
    """
    ssh {
      credentials = [
        {
          alias = testhost
          host = myhostname
          user = username
          password = changeme
        },
        {
          alias = testhost1
          host = myhostname1
          user = username1
          identity = "path/to/key.pem"
        }
      ]
    }
    """
 
  sssh.credentials = sssh.Credentials.from(ConfigFactory.load("default.conf"))
  
  //or configLike String 
  sssh.credentials = sssh.Credentials.from(ConfigFactory.parseString(configString))
  
  //or Create credentials directly
  sssh.credentials = Credential("testAlias", "testHost", "user", Some("pass"), Some(Paths.get(".ssh/key.pem"))
 
    
  //execute command
  sssh.execute("pwd")
  
  //execute scpFrom remote file
   sssh.scpFrom("wget-log")
  
  //or Create credentials directly from List
  sssh.credentials = List(Credential("testAlias", "testHost", "user", Some("pass"), Some(Paths.get("PATH/To/key.pub"))), Credential("testAlias1", "testHost1", "user1", Some("pass1"), None))
  
  //execute command on single host
  sssh.execute("pwd", "testAlias")

  //execute scpTo for file in current working directory
  sssh.scpTo("build.sbt")
  
  //execute scpTo from input stream 
  val in: InputStream = getClass.getClassLoader.getResourceAsStream("default.conf")
  sssh.scpTo("default.conf", in)

  //execute sudo command
  sssh.sudo("whoami")
}

Versions

Version
0.0.2
0.0.1