How to make chrome run with proxy properly?

If you found a way to make things work, and your only concern is getting too many warnings, you may do things your way discarding the messages:

<your command> 2> /dev/null

You would be redirecting file descriptor (FD) #2, which is stderr, to a "black hole". You may also want to discard messages sent to stdout (FD #1), although this is less common in cases like yours. You have to check how much clutter you get. So, you would have (redirecting only stderr):

google-chrome-stable --proxy-server="socks5://" 2> /dev/null &

or (redirecting stderr and stdout; these are alternative forms of the same command)

google-chrome-stable --proxy-server="socks5://" 2> /dev/null 1>&2 &
google-chrome-stable --proxy-server="socks5://" > /dev/null 2>&1 &

The syntax 2>&1 means redirecting FD #2 to wherever FD #1 goes. The default FD is #1, so > is equivalent to 1>.

For the rare cases you need more info than above, or for the sake of curiosity:

In Bash, what is file descriptor 255 for, can I use it?

I wrote about the various ways Google Chrome is affected by proxy settings. Rather than setting the proxy within Chrome, use the OS' settings instead.

If you are using GNOME, try using gsettings

gsettings set org.gnome.system.proxy.http host ""
gsettings set org.gnome.system.proxy.http port "3128"

Can you download a file from the Internet using wget or curl? Does the following command create an index.html file from Google's homepage?


If your problem is connecting to the SOCKS proxy and it is affecting other applications, try using proxychains or pacproxy.

$ proxychains4 google-chrome

Most likely, your attempt at editing google-chrome.desktop didn't work because that file has more than one Exec entry, and the one you changed wasn't the one that is actually used.

Using the Chrome package for Debian from Google's repository, google-chrome.desktop shows three Exec entries in three distinct sections (groups, in's nomenclature):

$ grep -E '^Exec|^\[|^Name=' /usr/share/applications/google-chrome.desktop 
[Desktop Entry]
Name=Google Chrome
Exec=/usr/bin/google-chrome-stable %U
[Desktop Action new-window]
Name=New Window
[Desktop Action new-private-window]
Name=New Incognito Window
Exec=/usr/bin/google-chrome-stable --incognito

The one with the --incognito option—likely the one you edited—is only executed when you select "New Incognito Window" from a context menu (e.g. after right clicking on Chrome's icon in GNOME Activities).

Unless your goal was to change the configuration for every user on your system, I suggest you to create your own, customized version of google-chrome.desktop:

$ cp /usr/share/applications/google-chrome.desktop ~/.local/share/applications/

And then edit the Exec entry, at least in the [Desktop Entry] group (you may want to keep the other Exec entries aligned to ensure Chrome will behave the same way no matter what menu entry you used to start it):

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

As noted by Dominik Matis in a comment, you may want to add the --host-resolver-rules option to prevent Chrome's DNS prefetcher from circumventing your proxy settings, as explained in the Chromium documentation.

Adjust proxyURL and proxyPORT as needed; don't forget to set proxyURL for both the --proxy-server and --host-resolver-rules options.

If you want the default opening action to run Chrome without setting any proxy, you may leave the main [Desktop Entry]'s Exec entry untouched and add an action instead. It requires you to

  1. add a name for a new action to the Actions key in the [Desktop Entry] group;
  2. add a new action group.
[Desktop Entry]


[Desktop Action new-proxied-window]
Name=New Proxied Window
Exec=/usr/bin/google-chrome-stable --proxy-server="socks5://proxyURL:proxyPORT" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE proxyURL" %U

"New Proxied Window" will then appear as an option when you right click on Chrome's icon (it may require a logout/login). Note that all the concurrently running instances of Chrome will share the same proxy settings of the first one you opened, unless you start them with the --user-data-dir option.