sshj | ssh , scp and sftp for java | SSH Utils library

 by   hierynomus Java Version: 0.37.0 License: Apache-2.0

kandi X-RAY | sshj Summary

kandi X-RAY | sshj Summary

sshj is a Java library typically used in Utilities, SSH Utils applications. sshj has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. However sshj has 48 bugs. You can download it from GitHub, Maven.

To get SSHJ, you have two options:. And, if you want, you can also run the SSHJ examples. Binary releases of SSHJ are not provided here, but you can download it straight from the Maven Central repository if you want to.

            kandi-support Support

              sshj has a highly active ecosystem.
              It has 2296 star(s) with 555 fork(s). There are 116 watchers for this library.
              There were 2 major release(s) in the last 6 months.
              There are 219 open issues and 392 have been closed. On average issues are closed in 79 days. There are 9 open pull requests and 0 closed requests.
              It has a negative sentiment in the developer community.
              The latest version of sshj is 0.37.0

            kandi-Quality Quality

              sshj has 48 bugs (7 blocker, 1 critical, 26 major, 14 minor) and 907 code smells.

            kandi-Security Security

              sshj has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              sshj code analysis shows 0 unresolved vulnerabilities.
              There are 17 security hotspots that need review.

            kandi-License License

              sshj is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              sshj releases are not available. You will need to build from source code and install.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              sshj saves you 10462 person hours of effort in developing the same functionality from scratch.
              It has 21259 lines of code, 2405 functions and 304 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed sshj and discovered the below as its top functions. This is intended to give you an instant insight into sshj implemented functionality, and help decide if they suit your requirements.
            • Reads a key pair
            • Initializes the cipher
            • Parses the key file
            • Derives an ARGON2 signature from the given headers
            • Read key pair
            • Read a PEM encoded encrypted key pair
            • Read encrypted private key info
            • Verify signature verification
            • Compute square root
            • Read a line from the file
            • Issue SSH - User Authentication process
            • Handle user challenge
            • Initialize cipher factories
            • Encodes the signature
            • Entry point for the ssh client
            • Main entry point for testing
            • Main loop
            • Main method for testing
            • Update the encrypted data
            • Demonstrates how to use the Google API
            • Handle SSH - User auth packet
            • Returns a signature for the current context
            • Handle incoming packets
            • Read a public key from a buffer
            • Processes the next kEX message
            • Process incoming messages
            Get all kandi verified functions for this library.

            sshj Key Features

            No Key Features are available at this moment for sshj.

            sshj Examples and Code Snippets

            Need information related to sshj library. How logging works?
            Javadot img1Lines of Code : 22dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            private void enableFineLogging() {
                try {
                    fileHandler = new FileHandler(
                            10000000, 1000, true);

            Community Discussions


            How to pass the private key as a String in Java in order to connect via SFTP using SSHJ?
            Asked 2022-Mar-12 at 06:21

            The following code works to connect via SFTP, the directory path of the key is used in order to load it.

            Here's the current code (I've specified the libraries just in case)



            Answered 2022-Mar-12 at 06:21

            Yes, you can invoke the follwoing method of the library to support the use-case.



            Set allowed transport and MAC ciphers for SSHClient
            Asked 2021-Dec-07 at 13:07

            I'm trying to modify an SSH client using SSHJ so that it only allows certain ciphers. I have properties in a properties file something like this:



            Answered 2021-Dec-07 at 13:07

            For future reference/anyone else who wants a quick solution, here's a derived class from DefaultConfig, as suggested by @Robert.



            How to correctly create a zip file that can be uploaded to AWS lambda using Eclipse?
            Asked 2021-Oct-21 at 20:21

            How do I create a zip file from an existing Java project that can be uploaded to an AWS Lambda function??

            I can't find any clear steps on how to do this. I want to export my Eclipse project as a zip file and then upload it to AWS Lambda. Currently, I use the AWS Toolkit in Eclipse to upload the project, but now I want to do it manually using a zip file.

            What are the steps?

            This is how I tried to do it. This is where I export the project as a zip:

            Then, I go to AWS and choose to upload a zip file:

            I choose my zip file and then test the code and this is the error I get:



            Answered 2021-Oct-21 at 20:21

            You can create a Maven project in Eclipse and then Export that as a JAR file that you can upload to the AWS Management Console. Its very easy to do so. To learn how to do this use case, see this AWS tutorial. It uses IntelliJ (just switch that for Eclipse), and follow the rest of the doc.

            The example use case for this Lambda function is to detect personal protective equipment (PPE) in images located in an Amazon Simple Storage Service (Amazon S3) bucket. It steps you through all steps including deploying the Lambda function.

            Creating an AWS Lambda function that detects images with Personal Protective Equipment

            You will never encounter issues that you are seeing in this tool when building and deploying via the Console.

            Update This Lambda function works -- just tested it. Here are the results in the Lambda Console.

            Data that is placed in the DynamoDB table:

            Your error is saying it cannot find the cred provider. When using Lambda, you do not need to set creds in your Java code. The permissions are set in the IAM role. You need to set the policy for the IAM role so it can invoke the services. SO in this example use case, we set policies for lambda-support.

            Another Update

            From Eclipse, I build a project using your code (I think this PPE is pretty advanced - so we will make a new one named Getting Started with Lambda). It worked well:



            Need information related to sshj library. How logging works?
            Asked 2021-Aug-24 at 05:41

            I'm trying to transfer a file from one server to other server using sftp protocol. So, I'm trying to use sshj library for this. Now before transferring the file I'm performing several activities such as zipping and after transferring unzipping . So, I'm logging this details to successLog and if ay error to FailureLog.

            here is my log4j properties:-



            Answered 2021-Aug-24 at 05:41

            Here's my example of writing the SFTP-session FINE-level log to file:



            how to avoid or disable default logging of sshj library
            Asked 2021-Aug-24 at 05:38

            I'm using SSHJ library to transfer files over sftp. I took help from the follwing blog:

            When I run the program it was throwing some sl4j issues, so I added sl4j dependencies in my project and added the BasicConfigurator in my code BasicConfigurator.configure();. Now it is printing everything on console. I want to disable that logging or log the sshj related log to another log file. How can I do that?



            Answered 2021-Aug-24 at 05:38

            It' been a while since I played with this but I think this is the key (and of course this can be done with configuration files):



            How to get pre-filtered file list from SFTP server using SSHJ
            Asked 2021-Apr-28 at 11:50

            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 tell the client to retrieve file list only from eg. ".zip" files so that it would have positive impact on the performance? Pseudo command:"*.zip")

            I know there is a method List path, RemoteResourceFilter filter) which will filter the list, but from what I understand, the filtering would happen only in client side? ie. the client would still receive whole file list and just after then it would be filtered.

            Is there any way to achieve this so that server would only return the names requested? Does the SFTP-protocol even support this?



            Answered 2021-Apr-27 at 09:54

            Indeed, the SFTP protocol does not have a way to provide a list of files matching any criteria. It does not matter, what SFTP library you are using.

            You would have to use another interface/API if you need the filtered list. If you have a shell access, you might use shell command ls *.zip.

            Or build you own (REST?) API.



            Java SSHJ library and enabling logging
            Asked 2020-Nov-26 at 10:02

            Below is a example section of my java 1.8 program. It appears to be failing when trying to authenticate. It goes through a number of authentication methods and then declares its run out. I would like to see debug information from within the sshj library to help me determine what's failing :- username, key exchange or something else. I am familiar with log4j and I can put logging statements within my code, but I can't find an example (simple to follow) which shows me how to hook up log4j to sfl4j and then tell sshj to use the logger.




            Answered 2020-Nov-26 at 10:02


            Java/Kotlin Output Ed25519 keypair as both JCE KeyPair instance and in OpenSSH format
            Asked 2020-Nov-13 at 10:53

            I'm generating Ed25519 key pairs in my Kotlin app using the BouncyCastle library and have two requirements that are easy to implement in isolation, but seemingly difficult to do in tandem:

            • Provide the key pair as a JCE KeyPair instance for use with a third-party SSH library
            • Provide the public key in OpenSSH .pub format for the user to copy and paste into a git repository provider such as GitHub (i.e. ssh-ed25519 )

            I have two options for generating the keys using BouncyCastle, each makes only one of these requirements easy.

            Generate directly using BouncyCastle generator ...


            Answered 2020-Nov-13 at 10:53

            Hack using reflection (wrapped into getter of extension property), following way #2 (get a Ed25519PublicKeyParameters instance from a BCEdDSAPublicKey):



            Workaround for unsupported SETSTAT request on SFTP server with sshj
            Asked 2020-Jun-17 at 17:41

            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.



            Answered 2020-Jun-05 at 05:29

            It seems that sshj SSHClient API does not allow preventing the use of the SETSTAT request. You will have to use more low level API, like SFTPFileTransfer:



            Failed to create Blob container in Microsoft Azure
            Asked 2020-May-29 at 14:16

            I followed the tutorial of Azure Blob storage service here and supplied the connection string from my storage account to create a container but it did not work as the container is not created and the application runs until I terminate it manually. I used azure-blob-storage API version 12.4.0.

            Here is the code:



            Answered 2020-May-29 at 14:16


            Thanks to Ihsan Haikal for sharing. If anyone who faces similar problems cannot create a container using the following method, please check the content of pom.xml The problem should not be the code but the configuration part.

            Original Answer:

            With this steps I can create container on my storage:

            First, import:


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install sshj

            You can download it from GitHub, Maven.
            You can use sshj like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the sshj component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer For Gradle installation, please refer .


            Implementations / adapters for the following algorithms are included:. If you need something that is not included, it shouldn’t be too hard to add (do contribute it!).
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone hierynomus/sshj

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular SSH Utils Libraries


            by openssl


            by solid


            by bastillion-io


            by sekey


            by hierynomus

            Try Top Libraries by hierynomus


            by hierynomusJava


            by hierynomusGroovy


            by hierynomusJava


            by hierynomusJava


            by hierynomusJava