Questions tagged [sshj]

SSHJ is an SSH Client library written in Java.

SSHJ is an SSH Client library written in Java. Its homepage is https://github.com/hierynomus/sshj/ and it is Apache 2.0 licensed.

The sourcecode is hosted publicly at https://github.com/hierynomus/sshj

118 questions
5
votes
3 answers

struggling with sshj example ('exec') : Could not verify `ssh-rsa` host key with fingerprint

I'm trying to write a java program that will connect via ssh and do some stuff on a server at work (redhat linux). My box is windows. I read about sshj and I'm trying to get the example to work. I've worked through most of the dependencies and…
hatrickpatrick
  • 195
  • 1
  • 2
  • 9
5
votes
2 answers

How to keep SSH connections alive using SSHJ?

I am developing a library that uses SSHJ for SFTP transfer. Since requests are frequent, I have wondered whether I could just keep the connection open. Obviously, this will achieve nothing if the server frequently times out the connection. Since I…
Urs Reupke
  • 6,791
  • 3
  • 35
  • 49
4
votes
1 answer

How can I use SSHJ to stream a file via SCP?

I am using the SSHJ library (https://github.com/shikhar/sshj). I can use sshClient.newSCPFileTransfer(); to get my SCPClient object, but then the call to scpClient.download() requires either a String as the path for the destination file or a…
Makoto
  • 1,520
  • 2
  • 12
  • 19
4
votes
2 answers

SSHJ hangs forever on join()

I execute some commands using SSHJ, I do it using this method: private Command executeCommand(String command, SSHClient client) { Command commandObject = client.startSession().exec(command); commandObject.join(); return commandObject; …
ilfrin
  • 261
  • 3
  • 10
3
votes
2 answers

SSH command execution fails with Exception - "net.schmizz.sshj.connection.ConnectionException: Connection reset Exception is thrown"

When a command is executed via SSH connection, often the command execution fails with Exception - "net.schmizz.sshj.connection.ConnectionException: Connection reset Exception is thrown". Problem description: I created a SSH connection instance to a…
Vijay Kumar R
  • 41
  • 1
  • 1
  • 4
3
votes
0 answers

Ctrl + c using sshj

I am using sshj to communicate from my java application try { final Command cmd = session.exec("tcpdump "); System.out.println(IOUtils.readFully(cmd.getInputStream()).toString()); cmd.join(5,…
Shashank Agarwal
  • 512
  • 3
  • 12
3
votes
1 answer

sshj executing script using nohup

I need to execute a shell script via sshj and disconnect without waiting for the script to complete. The script can take a long time to complete, so I will be creating additional Java code to periodically check for results from the script. How…
Michael Sobczak
  • 1,045
  • 1
  • 24
  • 45
3
votes
1 answer

SSH port fowarding with SSHj

I am trying to create a tunnel to use a service behind a firewall, that supports SSH. I wanted a complete solution in java, but I cannot seem to get it to work. I found this github snip and based on that I created the following code to keep a…
CodeReaper
  • 5,988
  • 3
  • 35
  • 56
2
votes
0 answers

How to detect SSH timeout with SSHJ SshClient

I'm seeing a situation where an SshClient (fromthe SSHJ library) is connected and then left idle long enough that the SSH connection times out ("timed out waiting for input: auto-logout". I want to gracefully trigger some behavior when this timeout…
Michael
  • 43
  • 5
2
votes
2 answers

Setting File filters when doing uploading and downloading of files in sshj v0.5.0

I have been using sshj libraries net.schmizz sshj 0.3.1 Following was my code using 0.3.1 which worked fine for doing uploading of files…
Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66
2
votes
1 answer

Meaning of different timeouts in SSHJ

I am trying to use SSHJ to connect to a SFTP from my Java application. There are a couple of different timeouts that are present but I can't find the difference between them. Even the official docs aren't very helpful. Can someone explain the…
2
votes
1 answer

How to get pre-filtered file list from SFTP server using SSHJ

I am using SSHJ SFTP library to get file list from SFTP-server. The connection to server is very slow and there are tens of thousands of files in directory. Often getting file list will end in various timeout / socket errors. Is there possibility to…
Jokkeri
  • 1,001
  • 1
  • 13
  • 35
2
votes
1 answer

Getting java.io.IOException: Trying to upload file XXXXXX to path XXXXX but that is a directory. While using net.schmizz.sshj.SSHClient

Getting this exception while doing SFTP to remote server Following is stack trace of exception java.io.IOException: Trying to upload file Test.pdf to path /MyFolder/NewTest/Test.pdf but that is a directory at…
2
votes
2 answers

Workaround for unsupported SETSTAT request on SFTP server with sshj

I'm trying to SFTP to a server using identity string: SSH-2.0-AWS_SFTP_1.0 with the following Java code using sshj. com.hierynomus sshj
conteh
  • 1,544
  • 1
  • 17
  • 39
2
votes
1 answer

Installing sshj or other java files

How would you go about getting sshj installed, considering that I'm using Eclipse on ubuntu? I haven't done anything with Java in 2 years and the only thing I sort of remember is how to add a jar file to a project, but in the case of sshj, I only…
Elxx
  • 463
  • 1
  • 5
  • 15