Home > Enterprise >  scp from linux to windows machine using jumphost
scp from linux to windows machine using jumphost

Time:02-10

Below command is working, I am able to download file from jumphost to my current directory in Windows machine using .pub file

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

As of now I am copying file to jumphost server using sftp, then doing scp to my windows machine. I would like to bypass jumphost and want to use 2nd hop to transfer file to Windows machine like below command

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

Error:

ssh: connect to host file_present_at_original_server port 22: Connection timed out

Updated Error using below command

scp  -i user_202201281017.pub  -o ProxyJump=user@jump_ip user@original_server:/home/user/check-job-status.sh .

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

CodePudding user response:

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?

  • Related