Skip to content

Instantly share code, notes, and snippets.

@Rubentxu
Forked from roskoff/set_proxy_ubuntu.sh
Created May 30, 2017 10:29
Show Gist options
  • Save Rubentxu/2788433e902a6e859020d84d64620a76 to your computer and use it in GitHub Desktop.
Save Rubentxu/2788433e902a6e859020d84d64620a76 to your computer and use it in GitHub Desktop.
Script para configurar proxy en Ubuntu 12.04
#/bin/bash
echo 'Removiendo las configuraciones actuales del proxy en:'
sudo sh -c '(echo "g/^Acquire::http::proxy/d"; echo "wq") | ex -s /etc/apt/apt.conf'
sudo sh -c '(echo "g/^Acquire::https::proxy/d"; echo "wq") | ex -s /etc/apt/apt.conf'
sudo sh -c '(echo "g/^Acquire::ftp::proxy/d"; echo "wq") | ex -s /etc/apt/apt.conf'
echo '/etc/apt/apt.conf'
sudo sh -c '(echo "g/^http_proxy/d"; echo "wq") | ex -s /etc/environment'
sudo sh -c '(echo "g/^https_proxy/d"; echo "wq") | ex -s /etc/environment'
sudo sh -c '(echo "g/^ftp_proxy/d"; echo "wq") | ex -s /etc/environment'
echo '/etc/environment'
sudo sh -c '(echo "g/^http_proxy/d"; echo "wq") | ex -s /etc/wgetrc'
sudo sh -c '(echo "g/^https_proxy/d"; echo "wq") | ex -s /etc/wgetrc'
sudo sh -c '(echo "g/^ftp_proxy/d"; echo "wq") | ex -s /etc/wgetrc'
echo '/etc/wgetrc'
echo -n
echo 'Usuario del proxy: '
read usuario
echo 'Contraseña: '
read pass
echo -n
echo 'Estableciendo configuraciones de proxy en:'
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http enabled true
gsettings set org.gnome.system.proxy.http use-authentication true
gsettings set org.gnome.system.proxy.http authentication-user $usuario
gsettings set org.gnome.system.proxy.http authentication-password $pass
gsettings set org.gnome.system.proxy.http host 'myproxy.mywork.com'
gsettings set org.gnome.system.proxy.http port 6789
gsettings set org.gnome.system.proxy.https host 'myproxy.mywork.com'
gsettings set org.gnome.system.proxy.https port 6789
gsettings set org.gnome.system.proxy.ftp host 'myproxy.mywork.com'
gsettings set org.gnome.system.proxy.ftp port 6789
gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.1/8', '*.pol.una.py']"
gsettings set org.gnome.system.proxy use-same-proxy false
echo 'Gnome System'
sudo sh -c "(echo 'Acquire::http::proxy \"http://$usuario:[email protected]:6789/\";') >> /etc/apt/apt.conf"
sudo sh -c "(echo 'Acquire::https::proxy \"https://$usuario:[email protected]:6789/\";') >> /etc/apt/apt.conf"
sudo sh -c "(echo 'Acquire::ftp::proxy \"ftp://$usuario:[email protected]:6789/\";') >> /etc/apt/apt.conf"
echo '/etc/apt/apt.conf'
sudo sh -c "(echo 'http_proxy=\"http://$usuario:[email protected]:6789/\"') >> /etc/environment"
sudo sh -c "(echo 'https_proxy=\"https://$usuario:[email protected]:6789/\"') >> /etc/environment"
sudo sh -c "(echo 'ftp_proxy=\"ftp://$usuario:[email protected]:6789/\"') >> /etc/environment"
echo '/etc/environment'
sudo sh -c "(echo 'http_proxy = http://$usuario:[email protected]:6789/') >> /etc/wgetrc"
sudo sh -c "(echo 'https_proxy = https://$usuario:[email protected]:6789/') >> /etc/wgetrc"
sudo sh -c "(echo 'ftp_proxy = ftp://$usuario:[email protected]:6789/') >> /etc/wgetrc"
echo '/etc/wgetrc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment