Skip to content

Instantly share code, notes, and snippets.

@dwdraju
Created July 23, 2018 11:38
Show Gist options
  • Save dwdraju/1fb6b72735261f6b3684172818766014 to your computer and use it in GitHub Desktop.
Save dwdraju/1fb6b72735261f6b3684172818766014 to your computer and use it in GitHub Desktop.
Static SSH Tunneling
#!/bin/bash

RUNNING=`ps aux | grep "ssh -i /root/.ssh/id_rsa -L .:880:localhost:80 " | grep -v grep | wc -l`

if [ $RUNNING -eq 0 ]; then
    screen -dm ssh -i /root/.ssh/id_rsa -L *:880:localhost:80 -L 4443:www.google.com:443 -R 880:localhost:80 username@yourvpsdomain
fi

Source: https://blog.zencoffee.org/2013/12/setting-static-ssh-tunnel/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment