Last active
December 16, 2015 23:49
-
-
Save satreix/5516108 to your computer and use it in GitHub Desktop.
SSH tunneling using sshuttle
This file contains hidden or 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/bash | |
user='username' | |
serv='servername' | |
echo "Connecting to $serv ..." | |
sshuttle --dns --daemon -r $user@$serv 0/0 | |
ssh_cmd_return=$? | |
if [[ $ssh_cmd_return != 0 ]]; then | |
echo -e "\033[31mConnection failed for $user@$serv\033[0m" | |
echo "Error : [$ssh_cmd_return] when executing command." | |
exit $ret_code | |
else | |
echo -e "\033[32m$user@$serv connected\033[0m" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment