Created
May 19, 2016 18:56
-
-
Save cyrilis/2563d1053b2bb503f9c3bc03fd91f8eb to your computer and use it in GitHub Desktop.
Port Forwarding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for ((i=1;i<=$#;i++)); | |
do | |
if [ ${!i} = "-from" ] | |
then ((i++)) | |
from=${!i}; | |
elif [ ${!i} = "-login" ]; | |
then ((i++)) | |
login=${!i}; | |
elif [ ${!i} = "-to" ]; | |
then ((i++)) | |
to=${!i}; | |
fi | |
done; | |
if [ -z "$from" ] ; then | |
echo ": $0 -from <From Port> -to <To Port> -login <Login>" | |
exit 1 | |
fi | |
echo "Logining in to $login... " | |
ssh -nNT -R $to:localhost:$from $login |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment