Download
#!/bin/sh
# $Id: ssh-tunnel,v 1.3 2005-12-03 04:32:37 luigi Exp $
# Luis Mondesi < lemsx1@hotmail.com >
#
# DESCRIPTION: creates a tunnel between 2 servers through ssh
# USAGE: ssh-tunnel.sh hostname.domain 3128 # opens a tunnel to a proxy server running (squid) on port 3128
# LICENSE: GPL
USAGE="USAGE: $0 [USER@]SERVER [PORT]"
LOCALHOST="127.0.0.1"
# ssh arguments
ARG=" -c blowfish -X "
if [ x$2 != "x" ]; then
# ssh -L LOCALPORT:127.0.0.1:REMOTEPORT user@remotehost
ssh $ARG -L $2:$LOCALHOST:$2 "$1"
else
echo $USAGE
fi