วันพุธ, พฤศจิกายน 21, 2555

HOWTO Set Ubuntu proxy ignore-hosts via command line

Instead of use dconf-editor to change the gnome proxy setting (on Ubuntu 12.10) I managed to use command line. This is howto set proxy configuration via command line:

gsettings set org.gnome.system.proxy.http host '127.0.0.1'
gsettings set org.gnome.system.proxy autoconfig-url ''
gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.0/8', '172.16.0.0/16','10.0.0.0/8']"
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy use-same-proxy false
gsettings set org.gnome.system.proxy.ftp host '127.0.0.1'
gsettings set org.gnome.system.proxy.ftp port 3128
gsettings set org.gnome.system.proxy.http authentication-password ''
gsettings set org.gnome.system.proxy.http authentication-user ''
gsettings set org.gnome.system.proxy.http enabled false
gsettings set org.gnome.system.proxy.http host '127.0.0.1'
gsettings set org.gnome.system.proxy.http port 3128
gsettings set org.gnome.system.proxy.http use-authentication false
gsettings set org.gnome.system.proxy.https host '127.0.0.1'
gsettings set org.gnome.system.proxy.https port 3128
gsettings set org.gnome.system.proxy.socks host '127.0.0.1'
gsettings set org.gnome.system.proxy.socks port 8010


Put those lines into a shell scripts; make it executable ;)
Note: For the ignore-hosts value we need to use double quote around the bracket

This command line will not work:
gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8', '172.16.0.0/16','10.0.0.0/8']

This is the correct syntax:
gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.0/8', '172.16.0.0/16','10.0.0.0/8']"