打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
SFTP编程开源框架jsch 异常问题汇总

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 deniedat com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2289)  

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.6 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.6+ JRE on the target server.
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
JAVA程序实现对SFTP服务器的操作,无密码
不保存直接读取压缩流内二级目录下的文件内容
command-line: line 0: Bad configuration option: PermitLocalCommand
系统运维工程师的法宝:python paramiko
第42天:Python paramiko 模块
Sublime Text 3设置吊炸天PHP开发环境
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服