linux - 从终端更改 Ubuntu 12.04 中的系统代理设置

标签 linux bash ubuntu configuration proxy

我一直在 Ubuntu 12.04 中工作,我试图在 Bash 脚本中实现的其中一件事是修改系统的代理设置。澄清一下,这将是一个脚本,用于设置我使用我需要的程序和包创建的每个 VM。我可以通过系统设置并选择网络手动查找和编辑代理设置,但我的目的是使这部分自动化。

到目前为止我尝试过的代码是:

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

我也尝试过使用 gconftool-2 进行上述操作。任何帮助将不胜感激。

最佳答案

您必须使用新的 gsettings 工具,而不是旧的 gconftool,键略有不同:

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'

关于linux - 从终端更改 Ubuntu 12.04 中的系统代理设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10234872/

相关文章:

linux - Bash - 检查用户是否通过 ssh 登录

python-3.x - 如何将 python 版本 3.5.6 安装到 ubuntu/Linux 中?

php - Godaddy Ubuntu 3.6 mod_rewrite 问题

Linux命令显示有关NFS挂载的信息

linux - du 的行为就好像总是给出 -h

linux - sed如何在第一行末尾添加带竖线的变量

linux - 字体大小渲染因使用 Gimp 登录而异?

bash - 从所有目录中删除 .svn 文件

regex - Linux - 只在一行中找到一个模式,而不是整行

android - Android Studio(Ubuntu)中Gradle执行错误