Class SshInfo

    • Field Detail

      • DEFAULT_SSH_DIR

        public static final File DEFAULT_SSH_DIR
        The default SSH directory; that's the .ssh directory under the user's home directory.
      • SSH_PRIVATE_KEY_FILE

        public static final String SSH_PRIVATE_KEY_FILE
        If you wish to specify a custom SSH private key location then you should launch your process with -Dssh.private.key.file=<your private key path>. This system property will be consulted before trying to load an SSH private key from its default location (as specified in DEFAULT_SSH_DIR).
        See Also:
        authenticate(SSHClient), Constant Field Values
    • Constructor Detail

      • SshInfo

        public SshInfo​(String sshInfo)
    • Method Detail

      • authenticate

        public net.schmizz.sshj.SSHClient authenticate​(net.schmizz.sshj.SSHClient client)
                                                throws net.schmizz.sshj.common.SSHException
        Authenticates an SSH client using this ssh-info.

        The recognized ssh-info structure is as follows: <user-name>;auth=<method>:<password>

        where:

        • <user-name> -- required, the user name
        • auth=<method> -- required, the authentication method; one of:
          • PASSWORD
          • PUBLIC_KEY; if this method is used, then an attempt to read an user defined SSH private key file will be made using the "ssh.private.key.file" system property, if that fails then it will fallback on reading id_rsa file from the DEFAULT_SSH_DIR
        • <password> -- required, the password; can be empty
        Parameters:
        client - the SSH client
        Returns:
        the authenticated SSH client
        Throws:
        net.schmizz.sshj.common.SSHException - authentication or transport failure