Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I tried to reset proxy of the terminal by some commands but it doesn't happen and automatically switches back to this proxy 172.16.0.16 (which apparently was my college proxy).

I checked in my system settings.I don't understand why this is recurring.
Please be comprehensive.Also I further would like to know how to bypass proxy server since I couldn't access any of the ubuntu repositories as they were blocked in my college's proxy settings as is Ubuntu's homepage.

Thanks for your time. Terminal snapshot

For sudo ls /etc/apt/apt.conf.d/ It displays a different set of options where proxy is not listed.I am on 12.10,if this should help any.I put a snap of the terminal after the above command has been entered. ls Command entered

share|improve this question

3 Answers 3

up vote 10 down vote accepted

Ubuntu 12.10 will set proxy settings both in /etc/environment and /etc/apt/apt.conf when you set proxy from GUI (Network Settings).

Check your apt settings

grep -Hnri proxy /etc/apt/

will list out the current proxy settings used by apt in the following format.

filename:linenumber:proxy-setting

If you see any output, it corresponds to apt's proxy settings. They will have to be cleared.

sudoedit <filename>

will allow you to edit the corresponding configuration file. Copy the existing contents somewhere in case you need to restore them, and delete or comment the lines that look like
Acquire::<protocol>::proxy=<your proxy here>
(Add // at the beginning of a line to comment that line. Commented lines are ignored.)

Save the files, close the text editor, and retry. If the problem persists,

Check global default environment.

grep proxy -i /etc/environment

Should list any proxy settings that are applied globally. If you need to clear them,

sudoedit /etc/environment

will fire up the text editor. Lines that start with # will be ignored, so add a # before those lines that mention your proxy settings. Save the file and retry.

Cleaning the user environment

It is possible that the systemwide configuration is clean but apt is picking up proxy settings from the user's environment. sudoin certain configurations by default, or when explicitly passed -E as an option, preserves the environment.

env | grep -i proxy

should list out any current environment proxy settings. unset <variable> can be used to unset or clear a variable. Unset all <protocol>_proxy variables. If they are automatically being set, you might comment out the corresponding entries from ~/.profile, ~/.bashrc, ~/.pam_environment

(Those are the most common files that contain the entries. All of them can be searched at once using grep -Hni proxy ~/.profile ~/.bashrc ~/.pam_environment )

share|improve this answer
    
Too bad,neither of them work.I am via a broadband connection,only the browsers are functional. –  therealnube Nov 28 '12 at 16:41
    
Try my updated answer. Notice the i option to grep which does a case insensitive search. –  Mahesh Nov 28 '12 at 18:58
    
Well i did not complete the last bit Cleaning the user environment But today it seems to magically work.Probably some code fixed itself :| What if i had to undo the operation ? Will changing in Network GUI again assign the required proxy in the future ? –  therealnube Nov 29 '12 at 12:18
    
Yes. Changing the setting from GUI will revert all the above changes. Just make sure you apply them system wide. –  Mahesh Nov 29 '12 at 13:34
    
Thanks a lot .. was very helpful –  therealnube Nov 29 '12 at 17:52

http://www.iasptk.com/how-to-change-system-proxy-settings-from-terminal-in-ubuntu-1204precise

How to change system proxy settings from terminal in ubuntu 12.04(Precise)

Configure Ubuntu desktop/laptop to use your proxy server from terminal.

Enable proxy setting from terminal in ubuntu 12.04

Open the terminal and run the following commands

Note:- change Host IP and port setting with yours.

gsettings set org.gnome.system.proxy.socks host '192.168.1.1′
gsettings set org.gnome.system.proxy.socks port 8080
gsettings set org.gnome.system.proxy mode 'manual'

Disable proxy setting from terminal in ubuntu 12.04

gsettings set org.gnome.system.proxy mode 'none'
share|improve this answer
1  
This would be the preferred way to set/clear proxy. The GUI (network proxy) does an equivalent job by using Gsettings bindings. However, this sets user level entries and apt may remain unaffected. –  Mahesh Nov 28 '12 at 18:43

app-get proxy setting is store at /etc/apt/apt.conf.d/20proxy

Also the filename may be something like 20proxy .

Attention: You need root permission to change or remove the file at /etc/apt/apt.conf.d .

This might be work :

$sudo ls /etc/apt/apt.conf.d/

00aptitude    15update-stamp  20proxy                99update-notifier
00trustcdrom  20archive       
01autoremove  20changelog     50unattended-upgrades
10periodic    20dbus          70debconf

$sudo mv /etc/apt/apt.conf.d/20proxy /etc/apt/apt.conf.d/20proxy~

if you can't find the file directly , search for Acquire::http::Proxy like this:

find /etc/apt/apt.conf.d | xargs grep "Acquire::http::Proxy`

Since the content of the file which set the proxy should be like so:

Acquire::http::Proxy "http:172.16.0.16:3142";

Some time the environment variable is set for it http_proxy, so do this:

export http_proxy=

share|improve this answer
    
This won't help sir,please guide me via steps.I can't access the list,the command $sudo ls /etc/apt/apt.conf.d/ shows me another list –  therealnube Nov 28 '12 at 9:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.