Skip to content

Instantly share code, notes, and snippets.

@alpegon
Created October 2, 2017 08:46
Show Gist options
  • Save alpegon/f7a27fc827e4dd6029836012e786896a to your computer and use it in GitHub Desktop.
Save alpegon/f7a27fc827e4dd6029836012e786896a to your computer and use it in GitHub Desktop.
scp files via intermediate host
#!/bin/bash
# Example invocation
# ./scp.sh test_file.tar.gz ub@192.168.0.1 ub@10.0.0.2:~
FILE=$1
INTERMEDIATE_HOST=$2
END_HOST=$3
scp -oProxyCommand="ssh -W %h:%p $INTERMEDIATE_HOST" $FILE $END_HOST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment