Skip to content

Instantly share code, notes, and snippets.

@sagz
Created March 24, 2014 21:29
Show Gist options
  • Save sagz/9749565 to your computer and use it in GitHub Desktop.
Save sagz/9749565 to your computer and use it in GitHub Desktop.
You ssh from your computer into serverA. Then you ssh into serverB. How to get files from serverB to your computer without first transferring them to serverA? What if there is not enough space on serverA to do this? You can do a multihop SCP like this-
scp -Cp -o "ProxyCommand ssh $username@$serverA nc $serverB 22" $username@$serverB:/path/to/remote/file ~/path/to/local/folder/
# Example
# scp -Cp -o "ProxyCommand ssh kjani3@newssh.physics.gatech.edu nc cygnus-6.pace.gatech.edu 22" kjani3@cygnus-6.pace.gatech.edu:/nv/hp11/kjani3/scratch/runs/test_precs_q1_m140/test6_precs_q1_m140/test8_precs_q1_m140/test8_precs_q1_m140/betax.x.asc ~/k/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment