How to use sshpass with scp over proxy jump

In this scenario we need to get some files from server B through using server A as a proxy jump, and additionally we need to pass the…

How to use sshpass with scp over proxy jump

In this scenario we need to get some files from server B through using server A as a proxy jump, and additionally we need to pass the password on the command line using sshpass, the password is common for both servers A and B, to achieve this we used the following command:$ sshpass -p password scp -r -J username@A username@B:/path/to_get/files/* .

Explaination:

  • sshpass -p: is used to pass the password in a non-interactive way
  • -r: means get files recursively from source
  • -J: the server to use as proxy jump host
  • .: the destination to copy the files to the local server
Join Medium with my referral link - Konstantinos Patronas
Read every story from Konstantinos Patronas (and thousands of other writers on Medium). Your membership fee directly…