Created
December 5, 2018 03:49
-
-
Save Abreto/9dd31cc8731033fd0d3aa739e8e36798 to your computer and use it in GitHub Desktop.
ssh proxy scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ps aux | grep "[0-9] ssh -qTfNn -D 7070" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
eval $(ps aux | grep "[0-9] ssh -qTfNn -D 7070" | awk '{print "kill -9 "$2}') | |
port=7070 | |
user=root | |
host= | |
case $1 in | |
hk ) | |
host=hk_server | |
;; | |
fm ) | |
user=special_user | |
host=fm_server | |
;; | |
la ) | |
host=la_server | |
;; | |
sh ) | |
user=another_user | |
host=sh_server | |
;; | |
*) | |
echo 'usage: ./connect <server_alias>' | |
echo 'server list: hk fm(fremont) la' | |
exit | |
;; | |
esac | |
echo connecting to $host | |
ssh -qTfNn -D $port $user@$host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
ALL_PROXY=socks5://127.0.0.1:7070 $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment