Advertisement
Phr0zen_Penguin

ssh_port_forward.sh - SSH Port Forwarding Bash Script

Mar 12th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.72 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # [ssh_port_forward.sh]
  4. #
  5. # SSH port forwarding script.
  6. #
  7. # syntax: ssh -L <local_port>:<destination_address>:<destination_port> <host_address|user@host_address>
  8. # eg:
  9. # ssh -L 21121:SkyLake.Centauri.dev:21 phr0z3n@IvyBridge.Centauri.dev
  10. # ssh -L 21121:SkyLake.Centauri.dev:21 phr0z3n@SkyLake.Centauri.dev             # For complete transmission encryption.
  11. #
  12.  
  13. if [ -z "$4" ]; then                    # If argument 4 is blank...
  14.     echo "Usage: $0 <local_port> <destination_address> <destination_port> <host_address|user@host_address>"
  15.     exit
  16. fi
  17.  
  18. if [ "$5" ]; then                       # If argument 5 is not blank...
  19.     echo "Usage: $0 <local_port> <destination_address> <destination_port> <host_address|user@host_address>"
  20.     exit
  21. fi
  22.  
  23. ssh -L $1:$2:$3 $4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement