Ssh Issues

Authentication failure

You get the following exception when using the Ssh plugin for remote connectivity:

        com.jcraft.jsch.JSchException: Auth fail
  1. If this is using a keyfile/passphrase connection, retry using a username/password instead.
  2. If username/password still fails, check that you can log on to the server via a command line from the framework server with the credentials you supplied. If you cannot log in, rectify the issue so that command line login works. The following tips may help.
    • Does the target server allows SSH with or without a passphrase (as required).
    • The user on the target server is correctly configured for SSH (has a .ssh or .ssh2 directory which contains the public key, and a correctly configured authorized keys file or directory).
    • Check that the users home directory, ssh directory and ssh files all have the correct permissions (ssh is very dependent on directory/file permissions).
    • Check that the user account is not locked.
    • Check that the user account is allowed to remote login.
    • Check that the user account has not reached its maximum failed login count.
    • Make sure you have accepted the target servers host key by making an SSH connection on the command line (for the first connection).

Channel Request failure

You see the following error:

        com.midvision.rapiddeploy.exceptions.CommandInvocationException: com.jcraft.jsch.JSchException: failed to send channel request  

Check your sshd_config, specifically the following and set them

        UsePAM yes
        PermitUserEnvironment yes
        Subsystem sftp /usr/libexec/openssh/sftp-server

Restart the Ssh daemon with:

        stopsrc -s sshd
        startsrc -s sshd

Jsch: Exception: - 4

You get the following exception when performing a copy using the Ssh plugin:

        SCP Copy returned an error:
        com.jcraft.jsch.JSchException: Could not get '<source directory>' to '<target directory>' - 4: 

You can occasionally get this exception on Unix/Linux hosts when one of the following conditions is met:

  • You have a space at the start of the filename e.g. " file1.txt"
  • The target file system is full
  • A file for download has a size of 0 bytes
  • There is a network connection issue

Jsch: Permission denied

You get the following exception when performing a copy using the Ssh plugin:

2013-08-06 13:32:16,171 [main] DEBUG com.midvision.rapiddeploy.utilities.exec.SshExec - Starting File Upload for source: path/to/source/file, to target: /path/to/target/file
Exception 3: Permission denied
at com.jcraft.jsch.ChannelSftp.throwStatusError(  

Check that the path to the target directory and file /path/to/target/file above, is writeable by the user connecting via Ssh. If not, alter the permissions so that the target is writeable, for example by using the chmod command.

UnsupportedClassVersionError - Wrong version of Java

You see the following exception after the deployment has copied the necessary files to the target, as the orchestration command is invoked:

        The java class could not be loaded. java.lang.UnsupportedClassVersionError:  (Unsupported major.minor version 49.0)
        SSH Command Execution Error (details follow):

        CommandExecutionException [RapidDeployBusinessException [com.midvision.rapiddeploy.exceptions.CommandExecutionException:

        SSHEXEC Command execution returned a non-zero error code: 1]]

The problem is that the executable was compiled with a Java version later than the current runtime version. RapidDeploy requires the runtime version be at least 1.8 to run the orchestration. To determine if the runtime Java supports the level of Java with which the program was compiled, follow these steps:

Check the runtime version of Java.

        java -version 
        For example, the output might look like this:
        java version "1.4.2"
        Java 2 Runtime Environment, Standard Edition (build 1.4.2)

You can resolve this issue by doing one of the following things:

  • Update the profile for the SSH user for RapidDeploy to select a later version of Java, by setting the JAVA_HOME and PATH variables accordingly.
            export JAVA_HOME=/path/to/java
            export PATH=${JAVA_HOME}/bin:${PATH}
  • Update the target server SSH plugin panel to set the remoteJavaPath to the path of an installed 1.8+ JRE on the target server.