-
-
Save ajkavanagh/7237185 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# setup local | |
BIND_ADAPTER="en0" | |
LOCAL_PORT=4000 | |
# setup remote | |
REMOTE_USER="user" | |
REMOTE_HOST="server.example.com" | |
REMOTE_PORT=9999 | |
echo "Make sure $REMOTE_PORT is open on $REMOTE_HOST and 'GatewayPorts yes' is set in the remote sshd.conf" | |
LOCAL=$(ifconfig $BIND_ADAPTER | grep 'inet ' | cut -d " " -f2 | awk '{print $1}') | |
echo "$REMOTE_HOST:$REMOTE_PORT -> $LOCAL:$LOCAL_PORT" | |
ssh $REMOTE_USER@$REMOTE_HOST -N -R $REMOTE_PORT:$LOCAL:$LOCAL_PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That looks cool! 👍