Skip to content

Instantly share code, notes, and snippets.

@maesoser
Created October 16, 2018 13:59
Show Gist options
  • Save maesoser/2a2befa48c9ffd0999f889f0d30708ff to your computer and use it in GitHub Desktop.
Save maesoser/2a2befa48c9ffd0999f889f0d30708ff to your computer and use it in GitHub Desktop.
far-ssh and far-scp, when you need to access or copy files through a server acting as a proxy.
function far-scp
if count $argv > /dev/null
echo Connecting through $argv[1]
echo Source: $argv[2]
echo Dest: $argv[3]
scp -oProxyJump=$argv[1] $argv[2] $argv[3]
else
echo " usage: far-scp [proxy-addr] [src] [dst]"
end
end
function far-ssh
if count $argv > /dev/null
echo Connecting to $argv[2] through $argv[1]
ssh -t $argv[1] ssh $argv[2]
else
echo " usage: far-ssh [proxy-ssh] [target-ssh]"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment