GithubHelp home page GithubHelp logo

jcabi / jcabi-ssh Goto Github PK

View Code? Open in Web Editor NEW
253.0 25.0 88.0 1.36 MB

Java SSH client (an object-oriented wrapper around JSch)

Home Page: https://ssh.jcabi.com

License: Other

Java 100.00%
java java-ssh-client ssh ssh-client

jcabi-ssh's Introduction

logo

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn PDD status Maven Central Hits-of-Code License

This project is just a parent POM for all other Java projects in "jcabi family".

See www.jcabi.com website for more details.

jcabi-ssh's People

Contributors

amihaiemil avatar andreoss avatar gvlasov avatar jrdalpra avatar linkedlist avatar lthuangiang avatar michaellampe avatar pnatashap avatar prondzyn avatar renovate[bot] avatar rultor avatar valery1707 avatar yegor256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jcabi-ssh's Issues

Unable to SSHByPassword using the given code

Hi
I have been trying to get this code working for the past 5-6 hrs but I have had no success so far. Kindly help me resolve this issue. I am working on eclipse and I want to ssh into my raspberry pi using SSHByPassword. I downloaded the jcabi-ssh-1.5-jar-with-depencies.jar. Running my code with this gives me the error :

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.io.IOException: com.jcraft.jsch.JSchException: Session.connect: java.net.SocketTimeoutException: Read timed out
at com.jcabi.ssh.SSHByPassword.session(SSHByPassword.java:147)
at com.jcabi.ssh.SSHByPassword.exec(SSHByPassword.java:108)
at com.jcabi.ssh.Shell$Plain.exec(Shell.java:172)
at Hope.main(Hope.java:10)
Caused by: com.jcraft.jsch.JSchException: Session.connect: java.net.SocketTimeoutException: Read timed out
at com.jcraft.jsch.Session.connect(Session.java:558)
at com.jcraft.jsch.Session.connect(Session.java:183)
at com.jcabi.ssh.SSHByPassword.session(SSHByPassword.java:144)
... 3 more

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> Next I added slf4j-nop-1.7.13.jar to my project reference library. I get the following error now: 

Exception in thread "main" java.io.IOException: com.jcraft.jsch.JSchException: Session.connect: java.net.SocketTimeoutException: Read timed out
at com.jcabi.ssh.SSHByPassword.session(SSHByPassword.java:147)
at com.jcabi.ssh.SSHByPassword.exec(SSHByPassword.java:108)
at com.jcabi.ssh.Shell$Plain.exec(Shell.java:172)
at Hope.main(Hope.java:10)
Caused by: com.jcraft.jsch.JSchException: Session.connect: java.net.SocketTimeoutException: Read timed out
at com.jcraft.jsch.Session.connect(Session.java:558)
at com.jcraft.jsch.Session.connect(Session.java:183)
at com.jcabi.ssh.SSHByPassword.session(SSHByPassword.java:144)
... 3 more

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

My code is as follows:

import com.jcabi.ssh.Shell;
import java.io.IOException;
import java.net.UnknownHostException;
import com.jcabi.ssh.SSHByPassword;
import com.jcabi.log.*;

public class Try {
   public static void main(String[] args) throws IOException{
        Shell shell = new SSHByPassword("192.168.1.2", 22, "pi", "abc");
        String stdout = new Shell.Plain(shell).exec("echo 'Hello, world!'");
      }
}

sudo command without password required

Hi,

Is it possible to send a sudo command without password required? What I mean is that I can execute a command to change the user, for example:

sudo /bin/change_user.sh

change_user.sh should change the user as if you executed su - username.

This command doesn't require the sudoer's password to be entered. When I send this command through the java client I get an empty response and later when I execute another command I get a permission denied which is correct because running whoami I can see that the user has not changed.

Any help is much appreciated.

Thanks.

SSH.java:70-72: This class has common data,...

Puzzle 21-74327cdd in src/main/java/com/jcabi/ssh/SSH.java:70-72 has to be resolved: This class has common data, implementation of exec() and constructor validations with SSHByPassword class. Common functionality should be extracted into a separate module.... The puzzle was created by Suseika on 22-Jun-2015.

If you have any technical questions, don't ask me, submit new tickets instead

SSH.java:72-74: Refactor this class into smaller ones...

The puzzle 30-15484dec in src/main/java/com/jcabi/ssh/SSH.java (lines 72-74) has to be resolved: Refactor this class into smaller ones to avoid null checking of passphrase. There should probably be separate classes for encrypted/unencrypted private key.

The puzzle was created by Martin Macko on 16-Mar-16.

Estimate: 30 minutes, role: IMP.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and
about me.

Use to SCP from local host to remote?

Is it possible to use this library to SCP a file from your local machine to a remote machine?

The only library that seems to do this well is JSch which seems like a beast of a library to try to understand and use.

IPv6 in SSHByPassword

Hi, Jcabi team!
Are you going to support IPv6-addresses in SSHByPassword because now we can only use IPv4-addresses?

Indie tech review no.1

Review our existing source code and all other technical artifacts and report at least 8 bugs. More about such reviews you can read here. The task will be closed once we have that bugs reported and classified. Don't forget to add itr tag to each of them.

SSHD.connect()

let's create a new method connect in SSHD class, which will return an instance of Shell

add support for option to ignore unknown host warning

It's quite common that you connect to a server for the first time, and you get the "unknown host" warning:

The authenticity of host '1.2.3.4 can't be established.
...
Are you sure you want to continue connecting (yes/no)?

This is a serious problem, because you get an interactive prompt that makes the jcabi library fail because it cannot establish a connection:

java.io.IOException: com.jcraft.jsch.JSchException: Algorithm negotiation fail

In ssh, you can bypass the host warning by passing the StrictHostKeyChecking option and another trick:

 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no

Some kind of support for this would be needed for jcabi imo.

Prevent SSHD from being started multiple times

While working on yegor256/thindeck#401 with the Thindeck project, I found that it's possible to call sshd.start() multiple times without having to invoke stop().

I think this is incorrect - we should only allow each SSHD instance to be started if it's not currently running. IllegalStateException should be thrown if start() was invoked on a running SSHD instance.

SSHByPassword and SSH does not support MDNS host addresses

Invalid IP address of the server `roborio-191-frc.local`
java.lang.IllegalArgumentException: Invalid IP address of the server `roborio-191-frc.local`
    at org.apache.commons.lang3.Validate.matchesPattern(Validate.java:875)
    at com.jcabi.ssh.SSHByPassword.<init>(SSHByPassword.java:91)

This is a valid SSH host address.


Workaround

Thanks to this stackoverflow post.

InetAddress address = InetAddress.getByName("roborio-191-frc.local");
String useThisAddress = address.getHostAddress();  // Use this in the constructor call

Please package the library as an OSGI bundle.

The MANIFEST.MF file in an OSGI bundle would be like this:

Manifest-Version: 1.0
Export-Package: com.vmware.vim25;uses:="javax.jws,javax.xml.bind,javax
 .xml.bind.annotation,javax.xml.datatype,javax.xml.namespace,javax.xml
 .ws"
Tool: Bundlor 1.0.0.RELEASE
Bundle-Vendor: VMware
Bundle-Version: 1.0.0
Bundle-Name: ws-vim25
Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.vmware.wsvim25
Created-By: 1.6.0_22 (Sun Microsystems Inc.)
Import-Package: javax.jws,javax.xml.bind,javax.xml.bind.annotation,jav
 ax.xml.datatype,javax.xml.namespace,javax.xml.ws

Please package the library as an OSGI bundle.so that we can use it in an OSGI Platform.

Whats the best way to stream the output?

Hi there,

The shell.exec interface can take a outputStream to get the returning response,

    int exec(String command, InputStream stdin,
        OutputStream stdout, OutputStream stderr) throws IOException;

I have used a few different OutputStream implementations trying to be able to read the output as the output comes in. I could easily pipe the output into input stream, but I found I could not read from input until the output is finished.

As an example, thinking if we are executing a long running or never ending command such as tail, of top, is there a way to be able to continuously feed the return?

I am thinking from a reactive programming point of view, if Jcabi can provide an API to do call backs for every line of response available.

If there are alternatives, please let me know.

Many thanks,
Jason

Wrong example of SSHD usage in README.md

Readme suggests using SSHD class like this:

try (SSHD sshd = new SSHD()) {
  String uptime = new Shell.Plain(
    SSH(sshd.host(), sshd.login(), sshd.port(), sshd.key())
 ).exec("uptime");
}

However, SSHD() no-arguments constructor doesn't exist. The only constructor is SSHD(File path).

Either the readme has to be fixed, or the consturctor implemented.

[Question] SFTP upload of sh script and running

I have a relatively simple use case.

I receive an InputStream of a script on my local machine, together with the destination on the remote machine. I need to do an SFTP upload to destination, chmod it and run it via "/bin/bash".

Now, given the following API
void transferAndRun(InputStream scriptInputStream, String destinationLocation) { ... }

I don't seem to be able to find a way to upload it, because the most verbose API I found is this:
shellProvider.shell().exec(command, scriptInputStream, Logger.stream(Level.INFO, this), Logger.stream(Level.WARNING, this))

Where will the contents of the InputStream be uploaded? Under which name? Is there something I'm overlooking?

Build fails under Windows 7

mvn clean install -Pqulice produces following error under Windows 7:

[WARNING] 2 XML validation error(s):
  -1:-1: schema_reference.4: Failed to read schema document 'http://maven.apache
.org/xsd/decoration-1.3.0.xsd', because 1) could not find the document; 2) the d
ocument could not be read; 3) the root element of the document is not <xsd:schem
a>.
  -1:-1: cvc-elt.1: Cannot find the declaration of element 'project'.
<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Copyright (c) 2014, jcabi.com
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met: 1) Redistributions of source code must retain the above
 * copyright notice, this list of conditions and the following
 * disclaimer. 2) Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following
 * disclaimer in the documentation and/or other materials provided
 * with the distribution. 3) Neither the name of the jcabi.com nor
 * the names of its contributors may be used to endorse or promote
 * products derived from this software without specific prior written
 * permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 --><project xmlns="http://maven.apache.org/DECORATION/1.3.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         name="jcabi-ssh"
         xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://mav
en.apache.org/xsd/decoration-1.3.0.xsd">
    <skin>
        <groupId>com.jcabi</groupId>
        <artifactId>jcabi-maven-skin</artifactId>
        <version>1.5.1</version>
    </skin>
    <bannerLeft>
        <name>jcabi</name>
        <src>http://img.jcabi.com/logo-square.svg</src>
        <href>http://www.jcabi.com/</href>
        <width>64</width>
        <height>64</height>
    </bannerLeft>
    <googleAnalyticsAccountId>UA-1963507-23</googleAnalyticsAccountId>
    <body>
        <head>
            <link href="http://img.jcabi.com/favicon.ico" rel="shortcut icon"/>
            <link href="https://plus.google.com/u/0/114792568016408327418?rel=au
thor"
               rel="author"/>
        </head>
        <menu name="Overview">
            <item href="./index.html" name="Introduction"/>
            <item href="./apidocs-${project.version}/index.html"
               name="JavaDoc ${project.version}"/>
            <item href="./cobertura/index.html" name="Test coverage"/>
            <item href="https://github.com/jcabi/jcabi-ssh/releases" name="Relea
se History"/>
        </menu>
        <menu ref="reports"/>
    </body>
</project>
[INFO] Read our quality policy: http://www.qulice.com/quality.html
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:51 min
[INFO] Finished at: 2015-01-25T21:24:51+04:00
[INFO] Final Memory: 37M/90M
[INFO] ------------------------------------------------------------------------

Qulice configuration - no license specified.

  1. Checkout master branch
  2. run mvn qulice:check -Pqulice
  3. There are multiple Line does not match expected header line of ' * BSD License'. (HeaderCheck) messages.

This is a known bug of qulice configuration in parent-0.31 (jcabi/jcabi-parent#19), accessed via jcabi-0.16. Suggested action is waiting until jcabi/jcabi#297 fix is released and upgrading jcabi version.

SSHD.start() Javadoc is misleading

In the Javadoc for SSHD.start(), it says:

Start SSHD and return port number it is listening on.

This is wrong. SSHD.start() has a return type of void; it's actually SSHD.port() that needs to be called to get the port number. Let's correct this.

How to interact with many commands

Is there any way to interact with shell? Like

ssh.exec("export TEST=1");
ssh.exec("echo $TEST"); // will print 1

how to do this?

Regards

Is pom.xml correct? Maven error

It can't be proxy problem.
Can you offer a jar release.

CNPVG50820394:/home/jcabi-ssh-1.4 # mvn install
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/com/jcabi/jcabi/1.16/jcabi-1.16.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.jcabi:jcabi-ssh:1.4 (/home/jcabi-ssh-1.4/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Could not transfer artifact com.jcabi:jcabi:pom:1.16 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Name or service not known and 'parent.relativePath' points at wrong local POM @ line 35, column 13: Unknown host repo.maven.apache.org: Name or service not known -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

1.5

Please, publish a new release 1.5 (or higher). Don't forget to update us here regularly (at least once a week), as explained in this article.

Rredirect output to null or file

I'm writing a small application to connect to a list of servers through SSH and execute a few commands. I'm using jcabi-ssh. When I run the program, jcabi-ssh outputs to the console with lines such as:

[main] WARN com.jcabi.ssh.SSH - Permanently added '192.168.4.2' (RSA) to the list of known hosts.
[main] INFO com.jcabi.ssh.Execution$Default - $ ping -c 1 google.com

My code snippet is as follows:

Shell shell = new SSHByPassword(targetServer.toString(), Integer.parseInt(port), username.toString(), password.toString());
exitCode=shell.exec("ping -c 1 google.com",stdin,stdout,stderr);

I would like to either hide the console output or redirect it to a file. I looked through the source but it seems like I can't do it through the method call. Is there a way to do what I wanted?

Thanks!

How to send data & read the response continuously

Thankyou for this great library Sir.

I have some questions, here is my flow:

  1. I connect to server A via SSH.
  2. After connected, then I want to connect to server B using netcat with this command: netcat -q -1 host port.
  3. Then I send data to server B for log on (ISO 8583).
  4. I send data to server B for echo test (ISO 8583).
  5. I send data to server B continuously for financial transaction (ISO 8583).
  6. I want to read the response from server B everytime I send the ISO.

But it always throw an error like this:
java.lang.IllegalArgumentException: non-zero exit code #127: ISO0110000170800100000100010000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000204153211031510001 <= log on message

My terminal output:

heru@aaa:~$ netcat -q -1 host port
ISO0110000170800100000100010000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000204143453093937001 <<< request logon
ISO011000017081010000010001000000000000000000000000000100000000000000000000000000000010000000000000000000000000000000000000000000000000000000000020414345309393700001 <<< response logon

ISO0110000170800100000100010000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000204143559059307301 <<< request echo
ISO011000017081010000010001000000000000000000000000000100000000000000000000000000000010000000000000000000000000000000000000000000000000000000000020414355905930700301 <<< response echo

ISO011000017020001110010001110100100000000000001000010001000001110000000000000101600000000000000003000000000000000000204141138098412141138020402047010040916000000000000000000000000000000400000250239865570310000411612100360006000001      <<< request financial
ISO011000017020001110010001110100100000000000001000010001000001110000000000000101600000000000000003000000000000000000204141138098412141138020402047010040916000000000000000000000000000000400000250239865570310000411612100360006000001aaaaa <<< response financial

My question is, how to send and read the response from server B continuously using this library? Thankyou & sorry for my bad English.

jcabi-ssh installation

Hi Yegor,
I very much would like to get jcabi-ssh to run. Am very new to Java and networking...

I get some NoClassDefFound error, see further below and attachment.

Is this a version incompatibility between Java and the jar file ?
Using Eclipse Neon.3 release (4.6.3) with Java version 1.8.0_121-b13
jcabi-ssh-1.5.2.jar

Hope you can help - best regards,
Paul

jcabi-ssh screenshot

Exception in thread "main" java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException
at connectPi.isAlive(connectPi.java:14)
at connectPi.main(connectPi.java:7)
Caused by: java.lang.ClassNotFoundException: com.jcraft.jsch.JSchException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more

SSHTest.java:164-167: EchoCommand and EchoCommandCreator are duplicated...

Puzzle 21-40f93421 in src/test/java/com/jcabi/ssh/SSHTest.java:164-167 has to be resolved: EchoCommand and EchoCommandCreator are duplicated in SSHTest and SSHByPasswordTest, these duplicates should be extracted into package com.jcabi.ssh.mock under src/main/java, renamed to MkCommandCreator/MkCommand and unit-tested.... The puzzle was created by Suseika on 22-Jun-2015.

If you have any technical questions, don't ask me, submit new tickets instead

Add todo format check to travis.yml

It would be good to check puzzle format with travis.
Need to update travis.yml with:

before_install:
  - set -e
  - pdd --source=$(pwd) --file=/dev/null

Broken link in README.md

In README.md, line 8 is as follows:

More details are here: [ssh.jcabi.com](http://sshs.jcabi.com/index.html)

The link is broken. It should be http://ssh.jcabi.com/index.html.

Shell with environment Var

Why doesn't the env var come with the connection? When i ssh with a program env var are there but not using script?

Invalid private key generated with OpenSSH

I am trying to use a private key generated with OpenSSH, but I always get an invalid private key exception. I am using Java8 and jcabi-ssh 1.5.
The private key is (it is for testing purposes):

-----BEGIN RSA PRIVATE KEY-----
8glbkhKvJ9OAOwX7iy7gcWzBLsENZouu/KIUg3yRIUQruM04Dvrd1Dv9mWifVHWT
1mAqeln1MRi3vR841NEhGD4vF3FmxY6tX+SYijEQ6RYcIthNTmc2GHf0hW2/yiny
0hjeoq1RYalD8SHknCM9ah2vHxVt6skBFpMoRJk9H56rEw+3TmZ7Fy5D0woT6fk2
Gl/Ntdr+h2fbWopPm6ZLoX32hFBE2mwRgjfC5Kwx3zDcSW2VGCZ2sBc/cFcv7B5z
lCcoR1xGj62sg2v9TCvdZ6hSBugbJ0w8pkrDCBBvK6ZrMqAZg/vp9uwB1bYh+VL3
rFlisD5qMI3/RTIw8Lh0loWAmS4Hn/Kq/SqXfyJT7zsXeF0aY3j+vRlx9qzb2rHZ
wKAq8vevVDOLT2y/rrKMBbKm7rPNFDyldTjnB9yX2dsod8oMhsxgqmPqrR1ukbdo
vd3SIHa+DjoA+gwZlpbas586oZZn3r83k5NbgUsn+ewOCax7B6RfMEtWKg+LVMYV
H+H4L/wLtMZcjYK/SnFhufweRjPzTnnJpd/Bq9P7DilodZygbBhR4k8/s8TbpQHr
yEeE9PKf6q+6NAd70KdLzTxf4T+P9svkW0pB6il/V3XWVrxpcdvlxRF7Xyi935Ay
GL2IvUK9Ndfns/bvjPqq6PpX/W8tr4qIeUakqsI1DsYkoKDALiqpXKWDhGHX6MxG
Ki01wA3D4Me3Yzgx71HPy9p6ujU/2Az0udp9he2WoKvEh1X7Bk9VRVnatP7tADUS
lC17Y2PevdUlYETS31x1gJ0lW+NROs7jwC9sgssykVriZoXftiWpuQVcGO1yyT6G
-----END RSA PRIVATE KEY-----

And the code I am using:

String privateKey = IOUtils.toString(
                JSchTest.class.getResourceAsStream("/org/arquillian/cube/containerobject/SshdContainer/test_rsa"), "UTF-8");
        System.out.println(privateKey);
        String hello = new Shell.Plain(
                new SSH(
                        sshdContainer.getIp(), 2222,
                        "test", privateKey
                        )
        ).exec("echo 'Hello, world!'");

Anything that I am going wrong, do I need another dependency?

SSHByPasswordTest.java:63-65: SSH server setup in this...

Puzzle 21-5047b140 in src/test/java/com/jcabi/ssh/SSHByPasswordTest.java:63-65 has to be resolved: SSH server setup in this class is nearly identical to the one in {@link SSHTest}. It should be extracted in a separate reusable module.... The puzzle was created by Suseika on 22-Jun-2015.

If you have any technical questions, don't ask me, submit new tickets instead

Excessive WARN messages

We are using this to send a bunch of commands to a Network Interface device. For every exec() command we get one of these WARN

15:34:59.554 [http-bio-8080-exec-7] WARN  com.jcabi.ssh.SSH - Permanently added '10.24.10.38' (RSA) to the list of known hosts.

here's how we're using the tool:

  Shell shell = new SSHByPassword("10.24.10.38", 22, "user", "password");
  for (commandList: command) {
    String output = new Shell.Plain(shell).exec(cmd);
  }

Is there something wrong with the way we are using this tool? Why are you trying to permanently add the IP address on each exec() I would assume that is done once when we new SSHByPassword

SSH.java:72-74: Refactor this class into smaller...

Puzzle 30-15484dec in src/main/java/com/jcabi/ssh/SSH.java:72-74 has to be resolved: Refactor this class into smaller ones to avoid null checking of passphrase. There should probably be separate classes for encrypted/unencrypted private key.... The puzzle was created by Martin Macko on 16-Mar-2016.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code.

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.