How to change system proxy settings from terminal in ubuntu 12.04(Precise)

If you are having ubuntu desktop/laptop in your office or at home behind proxy aerver this tutorial is for you.This tutorial will explain How to Configure Ubuntu desktop/laptop to use your proxy server from terminal.

Enable proxy setting from terminal in ubuntu 12.04

Open the terminal and run the following commands

Important Note:- Host IP and port setting will be different please check with your proxy administrator

gsettings set org.gnome.system.proxy.socks host ‘192.168.1.1'
gsettings set org.gnome.system.proxy.socks port 8080
gsettings set org.gnome.system.proxy mode ‘manual'

Disable proxy setting from terminal in ubuntu 12.04

gsettings set org.gnome.system.proxy mode ‘none'

Sponsored Link

Incoming search terms:

Related posts

7 thoughts on “How to change system proxy settings from terminal in ubuntu 12.04(Precise)

  1. when I run the ‘gsettings set org.gnome.system.proxy mode ‘none’ I get an error:

    ** (process:4676): WARNING **: The connection is closed

    ** (process:4676): WARNING **: The connection is closed

    When I ps aux | grep 4676 there isn’t a process associated with it.

    Any thoughts?

    [Reply]

  2. gsettings set org.gnome.system.proxy.http authentication-user true

    gsettings set org.gnome.system.proxy.http authentication-user ‘login’

    gsettings set org.gnome.system.proxy.http authentication-password ‘pass’

    [Reply]

  3. So now, script it so you can change from proxied to not proxied:

    #!/bin/bash
    ping -c 1 192.168.1.1
    if [ $? -eq 0 ]
    then
    gsettings set org.gnome.system.proxy.socks host ‘192.168.1.1?
    gsettings set org.gnome.system.proxy.socks port 8080 #squid uses 3128
    gsettings set org.gnome.system.proxy mode ‘manual’
    echo “Proxy set to 192.168.1.1 port 8080
    else
    gsettings set org.gnome.system.proxy mode ‘none’
    echo “No proxy”
    fi
    exit

    make it executable, put it in a directory in your path, and run it at will, or run it from /etc/local.rc (with the full path) on boot

    This is useful to me because sometimes my laptop is on my home ethernet, and sometimes on wireless.

    [Reply]

    Wastrel Reply:

    Oops, omit the indent on the shebang, and fully quote the echo statements.

    [Reply]

Leave a comment

Your email address will not be published. Required fields are marked *