I have an application that needs to change the proxy settings used by Google chrome, then use the browser and then automatically switch back the proxy to what it was.

I have been unable to find where on my Ubuntu system are these settings stored. Its not in the Preferences file for sure. Any ideas on how to go about this task?

  • Looks like you want to programmatically change the proxy settings. Changing them manually would involve opening up the Preferences section of the Chrome browser. What you want to do seems very strange -- what is the underlying goal of what you're trying to accomplish? There may be a simpler way of achieving that goal. Commented Aug 11, 2011 at 13:12
  • May be explaining why I wish to perform such a thing will help people offer alternate solutions. I wish to record all the traffic being served by Google Chrome. For that, I have a client who acts like a proxy server. Now, if I set the proxy of Chrome to localhost and a certain port, all the traffic will go through my client and my client will be able to record all thats happened. And when I am done recording what I need, I will shutdown chrome and restore its original proxy settings. I do not wish to use command line arguments passed onto Chrome browser and wish to do this programmatically.
    – Elitecoder
    Commented Feb 16, 2012 at 13:50

4 Answers 4


You can use the Chromium proxy settings from the command line. The man page tells you how. So here is an excerpt from man chromium-browser from my Ubuntu Natty:

          Specify the HTTP/SOCKS4/SOCKS5 proxy server to use for requests.  This overrides any environment variables or settings picked via the options dialog.  An individual
          proxy server is specified using the format:


          Where <proxy-scheme> is the protocol of the proxy server, and is one of:

            "http", "socks", "socks4", "socks5".

          If the <proxy-scheme> is omitted, it defaults to "http". Also note that "socks" is equivalent to "socks5".


                Use the HTTP proxy "foopy:99" to load all URLs.

                Use the SOCKS v5 proxy "foobar:1080" to load all URLs.

                Use the SOCKS v4 proxy "foobar:1080" to load all URLs.

                Use the SOCKS v5 proxy "foobar:66" to load all URLs.

          It is also possible to specify a separate proxy server for different URL types, by prefixing the proxy server specifier with a URL specifier:


                Load https://* URLs using the HTTP proxy "proxy1:80". And load http://*
                URLs using the SOCKS v4 proxy "baz:1080".

The advantage of using the command line arguments is, that you do not have to change your global system settings.

For example:

$ chromium-browser --proxy-server=""

Also have a look at Justin's post in this thread where he describes how to use the proxy for DNS request also.

  • 1
    Is there a way to set specific domains which should NOT use proxy? Something analogous to the No proxy for setting in Firefox...
    – a06e
    Commented Aug 20, 2014 at 14:49
  • 1
    chrome doesn't work because it hasn't option --host-resolver-rules="MAP * , EXCLUDE"
    – BeGood
    Commented May 26, 2017 at 4:46
  • 1
    doesn't work. chrome ignores all proxy settings
    – user27636
    Commented Oct 26, 2018 at 20:12

Strubbl's anwser is correct, this is the best solution, since you do not need to keep enabling/disabling system wide proxy settings.

I would add that you should also use this switch in conjunction

--host-resolver-rules="MAP * , EXCLUDE" 

where is your proxy server. This switch stops chrome from making external dns requests, which when privacy is important will not leak any DNS info.

So the complete command is as follows.

/usr/bin/google-chrome-stable %U --proxy-server="socks5://" --host-resolver-rules="MAP * , EXCLUDE"

For Ubuntu 14.04 LTS, go to the terminal. Open this file but save it first

& cp /usr/share/applications/chromium-browser.desktop /home/@user/

& sudo su



& gedit /usr/share/applications/chromium-browser.desktop &

Go to the first "Exec" line

Exec=chromium-browser %U

Change it to

Exec=chromium-browser %U --proxy-server="" or what ever. Save this file and close the editor and start the browser again and try it.

To make this change back

& sudo su


& cp /home/@user/chromium-browser.desktop /usr/share/applications/

or rewrite this line to

Exec=chromium-browser %U



Chromium and Google Chrome use the http_proxy, https_proxy and no_proxy environment settings. Accessing these is different from programming language to programming language. In a shell, you can type

echo $http_proxy

etc. They can be set in a multitude of ways. See https://askubuntu.com/a/513956/438156 and https://askubuntu.com/a/755100/438156.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .