Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Connecting to remote server local services via SSH tunnel
# 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:$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