Skip to content

Instantly share code, notes, and snippets.

@fxthomas
Created November 26, 2012 20:17
Show Gist options
  • Save fxthomas/4150353 to your computer and use it in GitHub Desktop.
Save fxthomas/4150353 to your computer and use it in GitHub Desktop.
Automatic tunnel for Mac OSX
#!/bin/bash
function enable_proxy {
echo "Enabling SOCKS proxy to localhost:8080"
networksetup -setsocksfirewallproxy wi-fi localhost 9999
}
function disable_proxy {
echo "Disabling SOCKS proxy"
networksetup -setsocksfirewallproxystate wi-fi off
exit 0
}
trap "disable_proxy" SIGINT
enable_proxy
ssh -Nv -D 9999 your_server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment