Skip to content

Instantly share code, notes, and snippets.

@devisnotnull
Last active May 28, 2018 21:36
Show Gist options
  • Save devisnotnull/e13a0fc59738f7d99c71a818ae2b7685 to your computer and use it in GitHub Desktop.
Save devisnotnull/e13a0fc59738f7d99c71a818ae2b7685 to your computer and use it in GitHub Desktop.
SSH port forward
#!/bin/sh
# Remote ARG1
# Remote port $ARG2
# Local port $ARG3
if [ $# -ne 3 ] ; then
echo 'Invalid aruments provided, Example ./cli.sh 192.158.1.1 5900 5900'
exit 1
fi
REMOTE=$1
REMOTE_PORT=$2
LOCAL_PORT=$3
ssh root@$REMOTE -L $REMOTE_PORT:127.0.0.1:$LOCAL_PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment