Skip to content

Instantly share code, notes, and snippets.

@wkoszycki
Created October 14, 2016 12:08
Show Gist options
  • Save wkoszycki/c5610e4eef7ac7c2c58bae7693e765e1 to your computer and use it in GitHub Desktop.
Save wkoszycki/c5610e4eef7ac7c2c58bae7693e765e1 to your computer and use it in GitHub Desktop.
switch on and off cntlm proxy on arch linux
#!/usr/bin/env bash
# /etc/bash.bashrc
function proxyOff(){
# stop cntlm service
systemctl stop cntlm.service
#remove all proxy env variables
sed -i.bak '/proxy/d' /etc/environment
# logout necessary to all gui non gui programs take changes
killall -u $user
}
function proxyOn(){
#make sure it's off
proxyOff
# start service
systemctl start cntlm.service
#declare env variables system wide
echo 'http_proxy=http://localhost:3128' >> /etc/environment
echo 'https_proxy=http://localhost:3128' >> /etc/environment
echo 'ftp_proxy=http://localhost:3128' >> /etc/environment
# logout necessary to all gui non gui programs take changes
killall -u $user
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment