Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scp interaction with windows server #152

Closed
wants to merge 1 commit into from

Conversation

olimpiks
Copy link

locale machine - linux
remote machine - windows (with winsshd server)

Command line is ok:

    user@linux:~$scp [email protected]:C:/qwerty/file.exe /tmp
    [email protected]'s password: 
    file.exe                                  100%   54KB  53.5KB/s   00:00

sshj before fix:

    public static void main(String[] args) throws Exception {
        String host = "192.168.10.188";
        String username = "ugl";
        String password = "123";
        String remotePath = "C:/qwerty/file.exe";
        String localPath = "/tmp/";
        SSHClient ssh = new SSHClient();
        ssh.setConnectTimeout(10);
        ssh.loadKnownHosts();
        ssh.connect(host);
        ssh.authPassword(username, password);
        ssh.newSCPFileTransfer().download(remotePath, new FileSystemFile(localPath));
        ssh.close();
    }

    Exception in thread "main" net.schmizz.sshj.xfer.scp.SCPException: Could not parse message ``
        at net.schmizz.sshj.xfer.scp.SCPDownloadClient.process(SCPDownloadClient.java:100)
        at net.schmizz.sshj.xfer.scp.SCPDownloadClient.startCopy(SCPDownloadClient.java:75)
        at net.schmizz.sshj.xfer.scp.SCPDownloadClient.copy(SCPDownloadClient.java:46)
        at net.schmizz.sshj.xfer.scp.SCPFileTransfer.download(SCPFileTransfer.java:64)
        at net.schmizz.sshj.xfer.scp.Test.main(Test.java:71)

sshj with fix is ok.

@hierynomus
Copy link
Owner

Have you also checked this against linux->linux connections?

@hierynomus
Copy link
Owner

And could you add a test?

@hierynomus
Copy link
Owner

This will not work as if there are double quotes in the original string, they now need to be escaped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants