first off, I know that this question has been asked before, but I'm very technologically illiterate and I'm unable to understand the answers (and they've all been answered a couple years at least), so please forgive me if this is inconvenient.

I'm trying to run an SCP command to remotely copy a linux directory (centOS) over to another remote machine (windows server 2016), but I'm experiencing an error when doing so "exec request failed on channel 0 lost connection".

scp -r serverName/var/tmp user@x.x.x.x:/backups/

I've verified that all the information is correct. When I enter the password after running the command, I'm getting the above error.

I'm not able to download any type of external software (reliable or otherwise) to assist in the matter, so any help at all would be much appreciated - if any kind soul would explain it in a simple, easy-to-understand manner, it would be very much appreciated.

EDIT: if there are any simpler ways to accomplish this, they would be very much appreciated!

  • Is the SSH service working on the Windows Server 2016 system? Start by troubleshooting whether SSH is working between the two systems, than figure out why SCP is not working. – 0xSheepdog Dec 27 '19 at 21:13
  • Hello, @0xsheepdog thanks for your response. Earlier I tried using "ssh-copy-id user@FQDN" and I received the error "exec request failed on channel 0" Would this be an error on Windows side? How would I go about verifying the service is functioning correctly? Thanks – John Anderson Dec 27 '19 at 21:29
  • 2
    As @0xSheepdog says, getting ssh to work is the first step, as scp uses ssh. The fact that ssh-copy-id is not working is a red flag. Start with ssh user@x.x.x.x, does it ask for a password? Do you get a command prompt on the windows machine? After that does ssh user@x.x.x.x pwd print out the home directory? This would indicate that you had something which could execute remote commands and knew enough unix to recognize "pwd" - you could try cmd /c dir instead. – icarus Dec 27 '19 at 22:51

Can you install WinSCP on Windows Server and create a new session connection pointing to Linux server? Then you can copy files over using that tool dragging a dropping directories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.