Wednesday, June 8, 2016

bash set HTTP_PROXY


 Set Linux/FreeBSD/NetBSD/OpenBSD environment HTTP_PROXY & HTTPS_PROXY variable in bash:
 
 
   export http_proxy=http://10.0.0.54:5127/
 
OR below line if username/password authorization is needed:
   export  http_proxy=http://USERNAME:PASSWORD@proxy.myname.com:3128/ 
 

   export https_proxy=$http_proxy
   export ftp_proxy=$http_proxy
   export rsync_proxy=$http_proxy
   export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
 
for compatibility reasons, below lines can be used too:
   export HTTP_PROXY=$http_proxy 
   export HTTPS_PROXY=$http_proxy
   export FTP_PROXY=$http_proxy 
   export NO_PROXY=$no_proxy
 
 
 Additionally, above lines can be added to ~/.bashrc for persistent settings.
 
Test the implementation using  wget http://www.synapse.ro
 
 
Never the less, in order to keep HTTP_proxy variables to sudo shell, add next line to sudo configuration file (/etc/sudoers):
 
Defaults env_keep += "http_proxy https_proxy ftp_proxy no_proxy rsync_proxy" 

No comments:

Post a Comment