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/* .
- 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