Skip to content

Instantly share code, notes, and snippets.

@kewogc
Created May 15, 2015 12:37
Show Gist options
  • Save kewogc/28ed31e624949dcd52f8 to your computer and use it in GitHub Desktop.
Save kewogc/28ed31e624949dcd52f8 to your computer and use it in GitHub Desktop.
scp over ssh

We have CLIENT, GATEWAY, REMOTE. Need to copy CLIENT->REMOTE.

##OPTION 1## (in one line)

#!bash
scp -rp -o "ProxyCommand ssh GATEWAY_USER@GATEWAY -p GATEWAY_PORT -W REMOTE:REMOTE_PORT" PATH_FROM REMOTE_USER@REMOTE:PATH_TO

##OPTION 2## (two lines)

#!bash
ssh -L CLIENT_ANY_PORT:REMOTE:REMOTE_PORT GATEWAY_USER@GATEWAY -p GATEWAY_PORT&
scp -rp -P CLIENT_ANY_PORT PATH_FROM REMOTE_USER@localhost:PATH_TO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment