How to use sshpass with scp over proxy jump

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

$ ./buy-me-a-coffee ☕ // found this useful? I write these in my spare time