Skip to content

Instantly share code, notes, and snippets.

@nathanchrs
Created February 23, 2017 12:53
Show Gist options
  • Save nathanchrs/a5e8c20bb3e1698bb2ca424c35ec4298 to your computer and use it in GitHub Desktop.
Save nathanchrs/a5e8c20bb3e1698bb2ca424c35ec4298 to your computer and use it in GitHub Desktop.
Bash script to disable proxy on Linux set by set-proxy script.
#!/usr/bin/env bash
# Disables proxy settings set by set-proxy.
# By nathanchrs.
# Set environment variables
export http_proxy=
export HTTP_PROXY=
export https_proxy=
export HTTPS_PROXY=
export ftp_proxy=
export FTP_PROXY=
export socks_proxy=
export SOCKS_PROXY=
export all_proxy=
export ALL_PROXY=
# Set Gnome settings
gsettings set org.gnome.system.proxy mode 'none';
# gsettings set org.gnome.system.proxy.http host "'$PROXY_HOST'";
# gsettings set org.gnome.system.proxy.http port $PROXY_PORT;
# gsettings set org.gnome.system.proxy.http authentication-user "'$PROXY_USER'";
# gsettings set org.gnome.system.proxy.http authentication-password "'$PROXY_PASSWORD'";
# gsettings set org.gnome.system.proxy.https host "'$PROXY_HOST'";
# gsettings set org.gnome.system.proxy.https port $PROXY_PORT;
# gsettings set org.gnome.system.proxy.ftp host "'$PROXY_HOST'";
# gsettings set org.gnome.system.proxy.ftp port $PROXY_PORT;
# Set apt proxy settings
echo "Sudo privileges required to write to /etc/apt/apt.conf.d/proxy"
sudo rm /etc/apt/apt.conf.d/proxy
echo "Proxy disabled."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment