Skip to content

Instantly share code, notes, and snippets.

@cooliscool
Last active August 20, 2017 18:01
Show Gist options
  • Select an option

  • Save cooliscool/962238f9ca3e08e8a8f21bcd83aa22c3 to your computer and use it in GitHub Desktop.

Select an option

Save cooliscool/962238f9ca3e08e8a8f21bcd83aa22c3 to your computer and use it in GitHub Desktop.
Automate Setting and Removing of SSH tunnel SOCKS Proxy in Ubuntu.
# Author : Mohammed Ajmal
# GNU Public License
# Tested to work well in Ubuntu 16.04
# use ` chmod +x removeproxy.sh ` to give executable permissions
gsettings set org.gnome.system.proxy mode 'none'
# Author : Mohammed Ajmal
# GNU Public License
# Tested to work well in Ubuntu 16.04
# use ` chmod +x setproxy.sh ` to give executable permissions
# Set these variables for your SSH server
# LOCAL_PORT is the port at which SOCKS proxy tunnels connections to SSH server
# USER is username of account in the SSH server
# SSH_SERVER is server address
# Check removeproxy.sh for proxy removal script
LOCAL_PORT=8080
USER=root
SSH_SERVER=1.1.1.1
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.socks port ${LOCAL_PORT}
gsettings set org.gnome.system.proxy.socks host 'localhost'
gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.0/8', '::1']"
ssh -D $LOCAL_PORT $USER@$SSH_SERVER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment