JSCH: No such file error

Nem

I have windows machine with running ssh server. I know the path on that machine. Let it be D:/Folder1/Folder2. I'm creating sftp channel using JSCH. But when i try to cd to D:/Folder1/Folder2, "No such file: 2" error is throwed.

can anyone please help? May be i need to convert path?

Nem

I've solved the problem by using ChannelExec by opening exec channel. This worked for me. Hope will work for others too.

    ...
    java.util.Properties config = new java.util.Properties();
    config.put("StrictHostKeyChecking", "no");

    JSch ssh = new JSch();
    session = ssh.getSession(sshSolrUsername, sshSolrHost, 22);
    session.setConfig(config);
    session.setPassword(sshSolrPassword);
    session.connect();
    channel = session.openChannel("exec");        
    ((ChannelExec)channel ).setCommand("cd " + sourcePath);     
    exec.setInputStream(null);
    ((ChannelExec)channel ).setErrStream(System.err);
    InputStream in = channel .getInputStream();
    channel .connect();
    int status = checkStatus(channel , in);
    channel.disconnect();
    ...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

JSCH: No such file error

From Dev

Permission error when getting file for use with JSch

From Dev

Async sftp file transfer with Jsch?

From Dev

Change file permissions with SFTP or SCP uing JSch

From Dev

Java JSch change file encoding while copying

From Dev

Change file permissions with SFTP or SCP uing JSch

From Dev

sftp JSch transfer file to remote cygwin

From Java

Testing jsch on gitlab results in invalid privatekey error

From Dev

SFTP via JSch is throwing error 4: Failure

From Dev

How to set file type and file transfer mode in JSch?

From Dev

Jsch connection with private key fails with com.jcraft.jsch.JSchException: Auth fail error

From Dev

Jsch connection with private key fails with com.jcraft.jsch.JSchException: Auth fail error

From Dev

Java: Can't delete local file after jsch.put

From Dev

How to use Java JSch library to read remote file line by line?

From Dev

Zip file corrupted (sort of) after SFTP transfer/put (Jsch)

From Dev

JSch SFTP file upload/download - why use the methods that return a stream?

From Dev

How to download SFTP file by using regular expression in JSch

From Dev

Java: Can't delete local file after jsch.put

From Dev

JSch SFTP file upload/download - why use the methods that return a stream?

From Dev

Reading remote file using jsch and sftp - Failure 4

From Dev

com.jcraft.jsch.JSchException: Auth fail error

From Dev

"session is down" error when opening an SSH channel with JSch

From Dev

Separating standard and error output of a command (sudo) executed with PTY with JSch Java

From Dev

com.jcraft.jsch.JSchException: Auth fail error

From Dev

How to do an atomic SFTP file transfer using JSch, so that the file is not accessable until the write process has finished?

From Dev

Redirecting output stream of JSch exec channel to a file using setOutputStream does not work

From Dev

From where two extra files named ( '.' and '..' ) came by getting file names from Vector in jSch SFTP

From Dev

How do I transfer a file from one directory to another using Java SFTP Library JSch?

From Dev

Java > JSch. How to get properties for SFTP connection from settings file?

Related Related

  1. 1

    JSCH: No such file error

  2. 2

    Permission error when getting file for use with JSch

  3. 3

    Async sftp file transfer with Jsch?

  4. 4

    Change file permissions with SFTP or SCP uing JSch

  5. 5

    Java JSch change file encoding while copying

  6. 6

    Change file permissions with SFTP or SCP uing JSch

  7. 7

    sftp JSch transfer file to remote cygwin

  8. 8

    Testing jsch on gitlab results in invalid privatekey error

  9. 9

    SFTP via JSch is throwing error 4: Failure

  10. 10

    How to set file type and file transfer mode in JSch?

  11. 11

    Jsch connection with private key fails with com.jcraft.jsch.JSchException: Auth fail error

  12. 12

    Jsch connection with private key fails with com.jcraft.jsch.JSchException: Auth fail error

  13. 13

    Java: Can't delete local file after jsch.put

  14. 14

    How to use Java JSch library to read remote file line by line?

  15. 15

    Zip file corrupted (sort of) after SFTP transfer/put (Jsch)

  16. 16

    JSch SFTP file upload/download - why use the methods that return a stream?

  17. 17

    How to download SFTP file by using regular expression in JSch

  18. 18

    Java: Can't delete local file after jsch.put

  19. 19

    JSch SFTP file upload/download - why use the methods that return a stream?

  20. 20

    Reading remote file using jsch and sftp - Failure 4

  21. 21

    com.jcraft.jsch.JSchException: Auth fail error

  22. 22

    "session is down" error when opening an SSH channel with JSch

  23. 23

    Separating standard and error output of a command (sudo) executed with PTY with JSch Java

  24. 24

    com.jcraft.jsch.JSchException: Auth fail error

  25. 25

    How to do an atomic SFTP file transfer using JSch, so that the file is not accessable until the write process has finished?

  26. 26

    Redirecting output stream of JSch exec channel to a file using setOutputStream does not work

  27. 27

    From where two extra files named ( '.' and '..' ) came by getting file names from Vector in jSch SFTP

  28. 28

    How do I transfer a file from one directory to another using Java SFTP Library JSch?

  29. 29

    Java > JSch. How to get properties for SFTP connection from settings file?

HotTag

Archive