Created
December 19, 2020 07:28
-
-
Save bryanjhv/498943eb6ed46e885bcb92ef83e4439a 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
# Modify them! | |
LPORT="${LPORT:-22}" | |
RPORT="${RPORT:-8022}" | |
SSH="${SSH:-"ssh -C -q -N -f"}" | |
TARGET="${TARGET:-"theuser@remotehost"}" | |
is_pi() { | |
# You can replace this check to your needs. | |
# Just make sure you return something true. | |
test -f /etc/rpi-issue -a -r /etc/rpi-issue | |
} | |
if is_pi | |
then | |
echo "Forwarding L$LPORT to R$RPORT" | |
$SSH -R "$RPORT:localhost:$LPORT" "$TARGET" | |
else | |
echo "Forwarding R$RPORT to L$RPORT" | |
$SSH -L "$RPORT:localhost:$RPORT" "$TARGET" | |
fi | |
echo "Connect to RPi using this command:" | |
echo " ssh pi@localhost -p $RPORT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment