Created
November 13, 2016 17:42
-
-
Save cathal/1b38b770fff5904d41f869aaf778a9b9 to your computer and use it in GitHub Desktop.
SOCKS Proxied SSH
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
# append the following to bash profile | |
# ~/.bash_profile or #~/.bashrc | |
export PATH="$PATH:~/bin" |
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
#!/bin/sh | |
# ~/bin/ssh-socks | |
# USAGE: ssh-proxy USERNAME@HOST | |
# : ssh-proxy -i ~/.ssh/id_rsa.private_key USERNAME@HOST | |
curl -sSf --socks5-hostname localhost:5678 www.google.com > /dev/null || status=$? | |
if [[ $status -ne 0 ]]; then | |
echo "No SOCKs proxy is open on port 5678. Open it first!" | |
echo "You can open a SOCKs proxy with SSH using:" | |
echo " ssh -D 5678 USERNAME@HOST" | |
exit 1 | |
fi | |
ssh -o ProxyCommand='nc -x localhost:5678 %h %p' $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment