Created
November 14, 2011 22:33
-
-
Save thiyagaraj/1365423 to your computer and use it in GitHub Desktop.
SSH port forwarding script to access servers beyond firewalls, but accessible via "jump" servers. Run this script on the "jump" server
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/sh | |
#RUN this script to establish connection SSH Forwarding to HOSTNAME_HERE" | |
port=`netstat -an | grep 65321 | grep LISTEN | tr -s " " | cut -d" " -f 4 | cut -d"." -f 2` | |
if [[ $port -ne 65321 ]] | |
then | |
echo "Please Enter JUMP_SERVER Password:" | |
`ssh -gL 65321:HOSTNAME_HERE:22 0` | |
else | |
echo "HOSTNAME_HERE Redirect is already running on port 65321" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment