rmm5t / tilda-bin

Ryan McGeary's personal ~/bin directory -- well at least the stuff that he wants to make public.

This URL has Read+Write access

tilda-bin / ssh-tunnel
100755 12 lines (9 sloc) 0.334 kb
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
 
: ${user:=${1:-$USER}}
: ${host:=${2}}
: ${sshport:=${3:-22}}
: ${localport:=${4}}
: ${remoteport:=${5}}
: ${remotehost:=${6:-localhost}}
 
echo "Tunneling to ${remotehost} via ${user}@${host}:${sshport} : ${localport} --> ${remoteport}"
ssh -p${sshport} -N -L *:${localport}:${remotehost}:${remoteport} ${user}@${host}