Skip to content

Instantly share code, notes, and snippets.

@fokot
Created October 4, 2017 11:13
Show Gist options
  • Save fokot/edbeec7de61552a291ef566bb55fba7e to your computer and use it in GitHub Desktop.
Save fokot/edbeec7de61552a291ef566bb55fba7e to your computer and use it in GitHub Desktop.
Bi-directional ssh tunnel
#!/bin/bash
export EXTERNAL_PORT=$(cat conf/application.conf | awk -F'=' '/web.port/ {printf $2}' | tr -d ' ')
# this is the port for externalAddress
export TEMP_PORT=3331
echo ""
echo "Connecting localhost:$EXTERNAL_PORT to <SERVER>:8076"
echo "As externalAddress in application.conf use \"http://localhost:$TEMP_PORT\""
echo ""
ssh -N -L8076:localhost:8076 -R$TEMP_PORT:localhost:$EXTERNAL_PORT <USER>@<SERVER>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment