Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ssh/scp through NAT, as long as $outer has nc
- # ssh v5.4+ should allow ssh -oProxyCommand="ssh -W $inner:%p" $outer $*
- # hosts could also be defined in .ssh/config:
- # Host foo
- # hostname inner
- # ProxyCommand ssh outer nc -w 1 %h %p
- sshh() {
- [ "$1" = "-h" ] && {
- echo "sshh [opts] outer inner [cmd]"
- return
- }
- [ $2 ] || return
- outer=$1
- shift
- ssh -oProxyCommand="ssh $outer nc -w 1 %h %p" $*
- }
- sscp() {
- [ "$1" = "-h" ] && {
- echo "sscp [opts] outer file inner:[file]"
- return
- }
- [ $3 ] || return
- outer=$1
- shift
- scp -oProxyCommand="ssh $outer nc -w 1 %h %p" $*
- }
Add Comment
Please, Sign In to add comment