com.jcraft.jsch.JSchException: java.io.IOException: Pipe closed

安稳与你 提交于 2019-12-25 05:13:47

问题


I am trying to copy a file over SFTP to another Host using Jcraft JSch (http://www.jcraft.com/jsch/). I am getting below error:

Connecting via SSH to somehost:22
com.jcraft.jsch.JSchException: java.io.IOException: Pipe closed
at com.jcraft.jsch.ChannelSftp.start(ChannelSftp.java:315)
at com.jcraft.jsch.Channel.connect(Channel.java:152)
at com.jcraft.jsch.Channel.connect(Channel.java:145)

Relevant code is below:

Channel channel = null;
    ChannelSftp channelSftp = null;
    Exception cause = null;
    try {
      connect();
      channel = session.openChannel( "sftp" );
      channelSftp = (ChannelSftp)channel;
      channelSftp.connect();
      assert channelSftp != null;
      try {
        channelSftp.ls( destDir );
      } catch( SftpException sftpEx ) {
        // Create destination folder, if it does not exist
        execCommand( "some command" + destDir );
      }

This was all good since last week, upgrading to latest jcraft version doesn't work. I referred to this and this (refer last comment on page), but could not reach to root cause. Any help?


回答1:


SSH was working without any issue. Problem was with SFTP module path in SSH config. Below link was not accessible.

# override default of no subsystems 
Subsystem sftp /usr/libexec/openssh/sftp-server


来源:https://stackoverflow.com/questions/42714133/com-jcraft-jsch-jschexception-java-io-ioexception-pipe-closed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!