Re: sudo not respecting /etc/sudoers
On Sun, 3 May 2015 13:04:50 +0530
Avinash Sonawane <email@example.com> wrote:
> Hello! I am using Debian Jessie with Xfce.
> I am using proxy to access the Internet. Here's my /etc/environment
> Whenever I say `$ sudo apt-get update` it says
> "Err http://security.debian.org jessie/updates Release.gpg
> Could not resolve 'security.debian.org'
> Err http://ftp.us.debian.org jessie Release.gpg
> Could not resolve 'ftp.us.debian.org'
> But whenever I say "# apt-get update" the proxy works and packages get
> fetched properly.
> After searching on the web I came to know that `sudo` does not carry
> the environment
> https://wiki.archlinux.org/index.php/Sudo#Environment_variables and
> also found out that to make `sudo` acrry the environment one should
> add `
> Defaults env_keep += "ftp_proxy http_proxy https_proxy no_proxy"` to
> /etc/sudoers (the recommended way according to arch wiki).
> So I changed my /etc/sudoers. Here is it http://paste.debian.net/170961/
> But still `$ sudo apt-get update` produces above error. And it's
> really an inconvenience for me to become root user to do apt thing.
> So why `sudo` not respecting `/etc/sudoers` ? Am I missing something?
There are at least three ways of doing the thing you need:
1) sudo -E apt-get update
2) Move 'Defaults env_keep…' to line 12 in /etc/sudoers (i.e. *before*
"User privilege escalation section")
3) sudo apt-get -o Acquire::http::Proxy=http://192.168.6.254:3128 update