In Ubuntu desktop, its desktop environment settings, including system proxy settings, are stored in DConf database, which is a simple key/value store. If you modify any desktop properties using System Settings menu, the changes are persisted in the DConf database backend. There are GUI-based or non-GUI-based ways to modify DConf database on Ubuntu. While System Settings or dconf-editor are graphical methods for accessing DConf database, gsettings or dconf are command-line tools that can modify the database.
Here is how to change system proxy settings from the command line using gsettings.
The basic usage of gsettings for reading and writing a particular Dconf setting is as follows.
To modify a DConf setting:
To read a DConf setting:
Change System Proxy Setting to Manual from the Command Line
The following commands will change HTTP proxy setting to "my.proxy.com:8000" on Ubuntu desktop.
$ gsettings set org.gnome.system.proxy.http port 8000
$ gsettings set org.gnome.system.proxy mode 'manual'
If you want to change HTTPS/FTP proxy to manual as well, use these commands:
$ gsettings set org.gnome.system.proxy.https port 8000
$ gsettings set org.gnome.system.proxy.ftp host 'my.proxy.com'
$ gsettings set org.gnome.system.proxy.ftp port 8000
To change Socks host settings to manual:
$ gsettings set org.gnome.system.proxy.socks port 8000
All these changes above are limited to the current Desktop user only. If you want to apply the proxy setting changes system-wide, prepend sudo to gsettings command. For example:
$ sudo gsettings set org.gnome.system.proxy.http port 8000
$ sudo gsettings set org.gnome.system.proxy mode 'manual'
Change System Proxy Setting to Automatic from the Command Line
If you are using proxy auto configuration (PAC), type the following commands to switch to PAC.
$ gsettings set org.gnome.system.proxy autoconfig-url http://my.proxy.com/autoproxy.pac
Clear System Proxy Setting from the Command Line
Finally, to remove manual/automatic proxy setting, and revert to no-proxy setting:
Subscribe to Ask Xmodulo
Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!