Scp from Linux to Windows

Scp from Linux to Windows machine using jumphost

If you have OpenSSH 8.0 and newer, you can use -J (jump) switch:

scp -r -i user_202201281017.pub -J user@jumphost_ip_address user@file_present_at_original_server:/home/user/check-job-status.sh .

With older version, but at least 7.3, use ProxyJump directive:

scp ... -o ProxyJump=user@jumphost_ip_address

For more options, see Does OpenSSH support multihop login?


With Windows build of OpenSSH (Win32-OpenSSH), you need the latest version in any case, as earlier versions had broken jump host support. They fail with:

CreateProcessW failed error:2 posix_spawn: No such file or directory

copy files from linux to windows

you should be able to script smbclient as part of a script

 smbclient -A authfile //windows_machine/D$ -c 'cd \\PATH\TO\Directory; get "Filename.txt" myfile.txt'

where authfile would be

username = <myusername>
password = <mypassword>

This would assume File Sharing enabled on the Windows Machine, and samba installed on the linux side. //windows_machine/D$ is the D Share. but you could replace it with whatever share you create.

or you could install an FTP server on your windows machine and can either script an FTP client or use something like curl || wget



Related Topics



Leave a reply



Submit