Connecting to remote server local services via SSH tunnel
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
# SSH tunnel, so it's possible to connect to remote server services via SSH | |
# argument: local_port, dest_port, host | |
ssh_tunnel () { | |
lsof -i:$1 > /dev/null 2>&1 || ssh -fNg -L $1:127.0.0.1:$2 $3 | |
} | |
# sample: mysql | |
ssh_tunnel 3307 3306 HOST | |
# sample: rabbitmq | |
ssh_tunnel 7673 7673 HOST | |
ssh_tunnel 7674 7674 HOST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment