Skip to content

Instantly share code, notes, and snippets.

@sergio
Last active June 28, 2019 02:05
Show Gist options
  • Select an option

  • Save sergio/f7643ef8786393ae7cdbef34e4064b6b to your computer and use it in GitHub Desktop.

Select an option

Save sergio/f7643ef8786393ae7cdbef34e4064b6b to your computer and use it in GitHub Desktop.
SSH to linux via tunnel #linux #ssh
LOCAL_PORT=2266
TARGET_PRIVATE_IP=172.100.6.108
TARGET_SSH_PORT=22
TARGET_SSH_KEY=~/.ssh/desarrollo_key.pem
TARGET_USER=ec2-user
PASSTHROUGH_PUBLIC_IP=54.68.190.33
PASSTHROUGH_SSH_PORT=2224
PASSTHROUGH_SSH_KEY=~/.ssh/rc-oregon-keypair.pem
PASSTHROUGH_USER=ubuntu
ssh -L ${LOCAL_PORT}:${TARGET_PRIVATE_IP}:${TARGET_SSH_PORT} -i ${PASSTHROUGH_SSH_KEY} -p${PASSTHROUGH_SSH_PORT} ${PASSTHROUGH_USER}@${PASSTHROUGH_PUBLIC_IP}
ssh -i ${TARGET_SSH_KEY} -p${LOCAL_PORT} ${TARGET_USER}@localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment