Created
November 25, 2023 14:43
-
-
Save dgacitua/78961d04c24b442de9c595c4153f418e to your computer and use it in GitHub Desktop.
Bash script to deploy a SSH Tunnel from remote server to local machine
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 | |
# Customize the following variables | |
REMOTE_USERNAME=myuser # Remote server username | |
REMOTE_HOST=server.myuser.info # Remote server domain or IP address | |
REMOTE_PORT=4000 # Remote server port to redirect | |
LOCAL_PORT=3000 # Local machine port where the remote port is redirected | |
echo -e "Tunneling to $REMOTE_HOST from remote port $REMOTE_PORT to local port $LOCAL_PORT" | |
ssh $REMOTE_USERNAME@$REMOTE_HOST -p 22 -L $LOCAL_PORT:localhost:$REMOTE_PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment