Ssh Issues
Authentication failure
You get the following exception when using the Ssh plugin for remote connectivity:
com.jcraft.jsch.JSchException: Auth fail
- If this is using a keyfile/passphrase connection, retry using a username/password instead.
- 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(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.
相关推荐
JSch - Java 实现的 SFTP(文件上传详解篇) JSch 是 Java Secure Channel 的缩写,JSch 是一个 SSH2 的纯 Java 实现。JSch 允许您连接到一个 SSH 服务器,并且可以使用端口转发、X11 转发、文件传输等,当然您也...
4. 在Java中,通过JSch库连接到SFTP服务器时,需要先建立一个JSch对象,然后创建一个Session(会话),并设置Session的配置属性。 5. 接着通过Session对象获取一个Channel(通道),并打开SFTP通道。此时可以利用...
在这个主题中,"SFTP下载(JSch可跨服务器)"着重讨论的是如何使用JSch库实现在Java程序中进行跨服务器的SFTP下载操作。JSch库提供了一个简洁的API,通过它我们可以创建连接、建立SFTP会话,并执行各种文件操作。 ...
在这个场景中,`jsch-0.1.51.jar`是JSch库的一个版本,它包含必要的类和方法来实现SFTP功能。 首先,要使用JSch进行SFTP操作,你需要在项目中引入`jsch-0.1.51.jar`。在传统的Java项目中,这通常意味着将该JAR文件...
sftp解决上传中文乱码,sftp.setFilenameEncoding("GBK");修改是不起作用的,修改源码后重新导出的jar包。
Java操作SFTP(Secure File Transfer Protocol)主要依赖于第三方库,如JSch。JSch是一个纯Java实现的SSH2库,允许开发人员连接到支持SFTP的服务器,进行文件的上传、下载以及执行其他相关操作。本文将详细介绍如何...
在Java编程环境中,有时我们需要与远程服务器进行文件传输,这时SFTP(Secure File Transfer Protocol,安全文件传输协议)就派上了用场。SFTP是基于SSH的文件传输协议,提供了安全的数据传输。在这个示例中,我们将...
jsch-0.1.53 不支持修改编码格式,sftp.setFilenameEncoding("GBK");这样修改是不起作用的,所以必须修改源码。此处是修改源码后重新导出的jar包。
JSch(Java Secure Channel)是一个开源的Java库,它实现了SSH2协议,包括对SFTP的支持。在本文中,我们将深入探讨SFTP的概念、JSch库的使用以及如何通过JSch进行SFTP文件传输。 首先,理解SFTP的基本工作原理很...
5. **错误处理**:JSch提供了详细的异常系统,可以帮助开发者识别和处理各种可能出现的问题,如网络问题、认证失败或权限问题。 6. **性能优化**:JSch支持批量传输,能有效提高大文件传输的效率。此外,它还支持...
在IT行业中,尤其是在...总结,JSCH是一个强大且灵活的Java库,通过它我们可以轻松地在Java应用程序中实现SFTP文件的上传和下载。结合SSH协议的安全性,JSCH为开发者提供了在不安全网络环境中安全传输文件的有效工具。
首先,`jsch.jar`是Java Secure Channel的缩写,这是一个由JCraft公司开发的开源项目。它提供了对SSH2协议的支持,包括公钥认证、密码认证、键盘交互式认证等多种认证方式,以及通过SFTP进行文件传输的功能。在项目...
利用com.jcraft.jsch进行SFTP下载文件,方便简单快捷操作SFTP
JSch(Java Secure Channel)是一个开源的Java库,它实现了SSH(Secure SHell)协议,允许Java应用程序进行安全的远程登录、文件传输和其他与SSH相关的操作。在本文中,我们将深入探讨JSch库的核心功能,以及如何...
该问题是由于SFTP协议的编码问题所致,可以通过设置编码方式来解决该问题。例如,可以使用UTF-8编码来解决乱码问题。 SFTP协议是一种安全的文件传输协议,提供了可靠的文件传输机制。通过JSch库,可以在Java应用...
总结,SFTP作为安全的文件传输协议,其源码实现涵盖了SSH连接管理、SFTP会话交互、文件操作和加密等多个方面。开发者可以通过学习相关开源库的源码,深入了解其工作原理,并在自己的项目中实现SFTP功能。
**JSCH库详解** JSCH(Java Secure Channel)是一个开源的Java库,它实现了SSH2协议,...尽管SFTP功能可能不是每个项目中的必需品,但了解和掌握JSCH的使用对于提升开发者的技能和解决问题的范围都是非常有价值的。