I have installed openssh-server from optional features on a Windows machine. I can ssh and scp (I need upload only) from my Linux box; However I don't like cmd shell, so I installed Cygwin and set it as default shell for openssh-server (configure shell for openssh). Now the ssh works but scp doesn't (again from my Linux box). scp hangs until I break it with Ctrl+c and no file is transferred. When I ran it with -v option, it hangs on debug1: Sending command: scp -v -r -t /tmp/

This behavior is 100% reproducible and switching the openssh-server shell between cmd and Cygwin.bat gives the explained results all the times.

I remember reading somewhere: the shell shouldn't echo anything or it won't work with scp, I checked ~/.bashrc and ~/.profile and didn't see anything printing out.

I tried set TERM=linux in Cygwin.bat but it didn't help.

I tried to find a way to distinguish scp from ssh in Cygwin.bat but couldn't find a way (my goal was to not start Cygwin64/bin/bash.exe for scp).

Thanks for reading.

  • 1
    I'm not sure why scp is hanging, but since you've already installed Cygwin, you might get better results by running Cygwin's ssh server, available in the openssh package. Mar 20 at 11:34

After I removed --login switch from bash command in cygwin.bat file, scp worked as expected.

I think removing this switch prevents .profile script to be executed, I couldn't find anything conflicting with scp in this file, so there may be other behavior changes too.

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.