ssh-tunnel 303 B

1234567891011121314151617
  1. #!/usr/bin/zsh
  2. if [ $# -eq 0 ]; then
  3. echo "Usage: $0 username@machine destination-port [local-port]"
  4. exit 1
  5. fi
  6. destination=$1
  7. destinationport=$2
  8. if [ $# -eq 2 ]; then
  9. localport=$destinationport
  10. else
  11. localport=$3
  12. fi
  13. ssh -q -N -L ${localport}:localhost:${destinationport} $destination