$ curl http://google.de # DNS resolution works fine
...
$ sudo curl http://google.de
curl: (6) Couldn't resolve host 'google.de'
$ echo $http_proxy
http://proxy:8080
$ cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
127.0.1.1 debian
# ip6-stuff below
$ hostname
debian
I am using Debian squeeze (LXDE) inside VirtualBox and can do admin stuff via a real root console or via su root. I added my user to the sudoers group and can do stuff like editing via sudo, e.g., sudo vim /etc/hosts. I'd like to use sudo instead of su root.
Why are curl (and other tools like aptitude) not able to resolve the hostnames, but when using them as normal user or plain root everything works fine?
Edit: Here is the solution (Thx to Paul):
$ sudo visudo
# add this line
Defaults env_keep = "http_proxy https_proxy ftp_proxy"
# above this line
Defaults env_reset
-x, --proxy <[protocol://][user@password]proxyhost[:port]>– Sachin Divekar Nov 25 '11 at 13:12http_*var in/etc/bash.bashrc, but Pauls solution also worked. Do I also have to set such var in/etc/environment? – Juve Nov 25 '11 at 13:44