Guest User

Untitled

a guest
Jun 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. # ssh/scp through NAT, as long as $outer has nc
  2. # ssh v5.4+ should allow ssh -oProxyCommand="ssh -W $inner:%p" $outer $*
  3. # hosts could also be defined in .ssh/config:
  4. # Host foo
  5. # hostname inner
  6. # ProxyCommand ssh outer nc -w 1 %h %p
  7. sshh() {
  8. [ "$1" = "-h" ] && {
  9. echo "sshh [opts] outer inner [cmd]"
  10. return
  11. }
  12. [ $2 ] || return
  13. outer=$1
  14. shift
  15. ssh -oProxyCommand="ssh $outer nc -w 1 %h %p" $*
  16. }
  17. sscp() {
  18. [ "$1" = "-h" ] && {
  19. echo "sscp [opts] outer file inner:[file]"
  20. return
  21. }
  22. [ $3 ] || return
  23. outer=$1
  24. shift
  25. scp -oProxyCommand="ssh $outer nc -w 1 %h %p" $*
  26. }
Add Comment
Please, Sign In to add comment