Skip to content

Instantly share code, notes, and snippets.

@satreix
Last active December 16, 2015 23:49
Show Gist options
  • Save satreix/5516108 to your computer and use it in GitHub Desktop.
Save satreix/5516108 to your computer and use it in GitHub Desktop.
SSH tunneling using sshuttle
#!/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