Changing system proxy settings in Ubuntu 12.04 from terminal

bash, configuration, linux, proxy, ubuntu

Solution

You must use new `gsettings` tool and not old gconftool, with a bit different keys:

gsettings set org.gnome.system.proxy.socks host '127.0.0.1'
gsettings set org.gnome.system.proxy.socks port 3128
gsettings set org.gnome.system.proxy mode 'manual'

# to disable proxy:
# gsettings set org.gnome.system.proxy mode 'none'

Problem

I've been working in Ubuntu 12.04 and one of the things that I am trying to implement in a Bash script is modifying the proxy settings of the system. To clarify, this would be a script that sets up each VM that I make with the programs and packages that I need. I can find and edit the Proxy settings manually through System Settings and selecting Network, but my intention is to automate this part. The code that I have tried up to now has been: ``` gconftool --set /system/http_proxy/host --type string *host* gconftool --set /system/http_proxy/port --type int *port* gconftool --set /system/http_proxy/use_http_proxy --type bool true gconftool --set /system/http_proxy/use_same_proxy --type bool true gconftool --set /system/proxy/mode --type string manual ``` I have also tried the above with `gconftool-2`. Any help would be appreciated.

Original source