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

Error in scp_send to Windows Hosts #276

Open
eeyun opened this issue Dec 6, 2022 · 1 comment
Open

Error in scp_send to Windows Hosts #276

eeyun opened this issue Dec 6, 2022 · 1 comment
Labels

Comments

@eeyun
Copy link

eeyun commented Dec 6, 2022

I'm hopeful that this is PEBCAK but I can't seem to resolve it no matter what I try.
Any attempts to scp_send a file to a windows host seem to fail on anything other than a relative filepath with no directory structures, all other paths panic at runtime with value: Error { code: Session(-28), msg: "failed to send file" }'.

For example the following code works but it places 'remote' in $HOME of the user and literally includes the single tics in the filename:

    let tcp = TcpStream::connect("IP.ADDR.OF.HOST:22").unwrap();
    let mut sess = Session::new().unwrap();
    sess.set_tcp_stream(tcp);
    sess.handshake().unwrap();

    sess.userauth_password(r"DOMAIN\username", "DomainUserPassword").unwrap();
    
    let buf = std::path::PathBuf::from("remote");
    let mut remote_file = sess.scp_send(buf.as_path(),
                                       0o644, 10, None).unwrap();

    remote_file.write(b"1234567890").unwrap();
    remote_file.send_eof().unwrap();
    remote_file.wait_eof().unwrap();
    remote_file.close().unwrap();
    remote_file.wait_close().unwrap();

ANY other pattern passed fails with this error including paths expecting that relative path to remain true. Scp to the host works fine from both linux and windows terminals. I see in the Event Viewer logs that there is no authentication issue so I'm kind of at a loss.

Examples of other paths I have attempted and this list is not exhaustive:

/C:/remote
c:/remote
/c/remote
/C/remote
C:\\remote
c:\\remote
c\\remote
C\\remote
Downloads/remote
Downloads\\remote
@samuel-falvo-wdc
Copy link

I'm running into a similar issue where the deposited file's name is surrounded by literal apostrophies. As a stop-gap measure, I can remotely execute a rename command to remove them; but this is a bandaid at best.

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

No branches or pull requests

3 participants