0

We have OpenSsh installed and running on remote windows server. When I connect to it through Remote Desktop and run scp on command prompt it gives all the available options for scp commnad.

but when I am trying to scp from my linux machine to it like scp myuser@windows-machine:test.txt . it's giving me the below error

'scp.exe' is not recognized as an internal or external command,
operable program or batch file.

I can do ssh using the same user credential and after doing ssh if i run the scp there still it gives the same error.

Can anybody please help if I am missing some configuration on remote windows machine ?

Thanks,

Manish
  • 111
  • 1
    Sounds like where scp.exe is isn't in the PATH environment variable set for the ssh session. Not sure how/where to set it if you are using the build Microsoft ships though. – Tom Yan Jul 06 '21 at 05:59

1 Answers1

0

Your question does not seem consistent. You say you run
ReEditted thanks to Kamil's comment

homedir@linuxhost$ scp myuser@windows-machine:test.txt .

Yet your error message is literally generated by a windows shell.
That doesn't seem right, unless...... You are running PowerShell as your shell on your linux system

On my windows system with OpenSSH-server installed there are 2 instances of scp.exe:

homedir@linuxhost ssh myuser@windows-machine where scp
C:\Windows\System32\OpenSSH\scp.exe
C:\Program Files\OpenSSH-Win64\scp.exe

Strangely the actual executable used by sshd is the one in "Program Files". Perhaps (re)installing the OpenSSH-client feature will fix your problem.

aribi
  • 121
  • -1. scp works by ssh-ing to the server and running scp as a shell command there. Compare the beginning of this answer of mine, also my comments under this question. If the remote shell cannot find scp then it will generate an error message. The error message from a Windows shell does not mean the OP uses PowerShell on the client. – Kamil Maciorowski Jul 16 '21 at 21:06
  • Have you seen the linked answer? scp on the client runs something like ssh … user@server 'scp …' and the remote shell is involved in running scp on the server. – Kamil Maciorowski Jul 16 '21 at 23:02