Return to Snippet

Revision: 63295
at April 23, 2013 20:02 by miceno


Initial Code
#!/usr/bin/env bash
if [ -z "$1" -o "$1" = "-h" ]; then
  echo "$(basename $0): [ [SOURCE_HOST [SOURCE_PORT [TARGET_HOST [TARGET_PORT [USERNAME] ] ] ] ] ]"
  exit 0
fi
SOURCE_HOST=${1:-0.0.0.0}
SOURCE_PORT=${2:-7722}
TARGET_HOST=${3:-localhost}
TARGET_PORT=${4:-22}

USERNAME=${5:-bewifi@localhost}
DEBUG=""
#DEBUG=echo

$DEBUG ssh -f "$USERNAME" -L $SOURCE_HOST:$SOURCE_PORT:$TARGET_HOST:$TARGET_PORT -N

Initial URL


Initial Description
This script opens an SSL tunnel between a source host and a target host.

Initial Title
Bash SSH Tunnel

Initial Tags
Bash, ssh

Initial Language
Bash