I want to set system Proxy address through my Qt application. So i was wondering if i could write a script which can be executed by my application every time to change the proxy address.

I tried :

 #! /bin/sh 
 echo "# Generated by Application"

 export $1
 echo "Proxy Address ${1}

but this script was not successful. I think it was unable to execute "export" command.

Can anyone help me resolving this issue ?

1 Answer 1


Try this:

#! /bin/sh
echo "# Generated by Application"
export http_proxy='http://$1/'
export ftp_proxy='http://$1/'


  • your argument string($1) should be like this

user_id:[email protected]:proxy_port

  • If you do not use userid and password then argument string($1) should be


  • you can export https_proxy and socks_proxy if you need.
  • To see if your proxy is set or not use env | grep proxy

To change system proxy using shell script try these:

gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http enabled true
gsettings set org.gnome.system.proxy.http host 'proxy.server.addr'
gsettings set org.gnome.system.proxy.http port proxy_port

If you have user authentication pass and id

gsettings set org.gnome.system.proxy.http authentication-user 'user_id'
gsettings set org.gnome.system.proxy.http authentication-password 'password'

To use http_proxy for all other proxy

gsettings set org.gnome.system.proxy use-same-proxy true

To set bypass proxy for any host

gsettings set org.gnome.system.proxy ignore-hosts "['localhost',  '', 'all', 'other', 'hosts']"
  • 1
    Wow, this is still relevant and worked great for me on Ubuntu 18.04!
    – labyrinth
    Commented Dec 23, 2019 at 23:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .