Skip to content

Instantly share code, notes, and snippets.

@yalab
Created January 12, 2012 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yalab/1597598 to your computer and use it in GitHub Desktop.
Save yalab/1597598 to your computer and use it in GitHub Desktop.
SSH Tunnering
#!/bin/zsh
USER='yalab'
SOURCE_HOST='YOUR GLOBAL IP ADDRESS'
SOURCE_PORT=8888
DEST_HOST='DESTINATION HOST IP ADDRESS'
DEST_PORT=22
SSH_KEY='/home/yalab/.ssh/id_rsa'
sudo kill `ps ax | grep 'ssh -N'| awk '{print $1}'`
SSH_SERVER='ssh.yalab.org'
sudo ssh -N -L $SOURCE_HOST:$SOURCE_PORT:$DEST_HOST:$DEST_PORT $SSH_SERVER -l $USER -i $SSH_KEY &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment