Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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 ftp_proxy=
export FTP_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