Issue
When I use any command with sudo the environment variables are not there. For example after setting HTTP_PROXY
the command wget
works fine without sudo
. However if I type sudo wget
it says it can't bypass the proxy setting.
Solution
The trick is to add environment variables to sudoers
file via sudo visudo
command and add these lines:
Defaults env_keep += "ftp_proxy http_proxy https_proxy no_proxy"
taken from ArchLinux wiki.
For Ubuntu 14, you need to specify in separate lines as it returns the errors for multi-variable lines:
Defaults env_keep += "http_proxy"
Defaults env_keep += "https_proxy"
Defaults env_keep += "HTTP_PROXY"
Defaults env_keep += "HTTPS_PROXY"
Answered By - Ahmed Aswani Answer Checked By - Gilberto Lyons (WPSolving Admin)