In my office i want to update and download through (wget) and here they are using proxy?
How can i do this by commandline?
In some releases sudo is configured in such a way that all environment variables all cleared when running the command. To keep the value for your http_proxy and fix this, you need to edit /etc/sudoers, run:
Then find a line that states:
and add after it:
Defaults env_keep = "http_proxy ftp_proxy"
Things will start working as expected.
Thanks to kdogksu in the Ubuntu Forums for finding the solution for this.
In order to not only fix apt-get but also graphical X11 utils as e.g synaptic,mintintall, ...) the following line in
/etc/sudoers should do the job :
Defaults env_keep = "http_proxy https_proxy ftp_proxy DISPLAY XAUTHORITY"
ubuntu@ubuntu:~$ cat /etc/apt/apt.conf Acquire::http::Proxy "http://Username:Password@proxy.foo.bar.edu.au:8080";
This is what I use. Works perfectly.
Apt also allows individual settings to be placed in files under
/etc/apt/apt.conf.d/, so this has exactly the same effect as the above, but may be easier to maintain if you have other lines in the
ubuntu@ubuntu:~$ cat /etc/apt/apt.conf.d/05proxy Acquire::http::Proxy "http://Username:Password@proxy.foo.bar.edu.au:8080";
Ubuntu is incredibly hostile to authenticating proxies. I use an Ubuntu laptop at work and the number of breakages is incredible.
Synaptic, Apt, Firefox, Chromium, etc all use different methods for specifying a proxy and there's nowhere to specify credentials securely.
Some bugs on the subject : https://bugs.edge.launchpad.net/ubuntu/+source/msttcorefonts/+bug/220070
Oli's suggestion to use an export is the only vaguely secure way to do it. It's also sometimes possible to "fudge" proxy support if the proxy server is using secondary authentication to minimise load on the main authentication servers (say perhaps Active Directory). This is where the first proxy connection is authenticated by the proxy against AD, then for a set time period (usually 5 minutes) all other connections are "trusted" to be that user. Therefore, you can open firefox, browse the internet (anywhere will do), then try your utility (wget, synaptic, whatever) by specifying a proxy, but leave the username blank.
Ubuntu is generally hostile to any corporate environment simply because it allows passwords to be read so easily. Seahorse is a prime culprit, but Network Manager is also shocking - connect to any PEAP authenticated network and you've just stored your password in the applet for anyone to see who might borrow your laptop. Apparently laptop sharing is considered sacrilege in Linux land, since Seahorse developers rejected claims of insecurity. After that, I didn't have the heart to contact the network-manager devs.
If it is a temporary configuration, you could try this: sudo bash -c 'http_proxy="http://< proxy_host >:< proxy_port >/" apt-get update'
You need this, because the environment variable needs to be defined for the "root" account. Doing and export before should not work.
For a permanent configuration, you will have to modify a system file. This is already described in the following answer about How to check Network proxy is really applied?.