2010-10-05 16:55:44 +0000 2010-10-05 16:55:44 +0000
22
22
Advertisement

Línea de comandos de Linux para desactivar el proxy

Advertisement

¿Puedes mostrarme la línea de comandos para desactivar el proxy cuando estoy usando el terminal de línea de comandos en Ubuntu?

Advertisement
Advertisement

Respuestas (7)

28
28
28
2011-02-21 07:27:47 +0000

Como dice la otra respuesta, hay algunos programas que no miran el sistema en absoluto, por lo que es posible que tengas que configurarlos individualmente. Por ejemplo wget tiene una serie de opciones de proxy, que pueden ser utilizadas para ignorar o adaptar la configuración del proxy del entorno durante la ejecución. Aquí hay un número de áreas en las que los proxys del sistema pueden ser configurados.

  • Cómo se ve mi sistema, tenga en cuenta que tendrá que cambiar la configuración del sistema especificada para su entorno de red.

Algunos sistemas Linux usan /etc/environment

$ cat /etc/environment 
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
http_proxy="http://192.168.1.250:8080/"
ftp_proxy="ftp://192.168.1.250:8080/"
https_proxy="https://192.168.1.250:8080/"

No hay una configuración única y uniforme que no sea env

$ env | grep -i proxy
NO_PROXY=localhost,127.0.0.0/8,127.0.1.1
http_proxy=http://192.168.1.250:8080/
FTP_PROXY=ftp://192.168.1.250:8080/
ftp_proxy=ftp://192.168.1.250:8080/
all_proxy=socks://192.168.1.250:8080/
ALL_PROXY=socks://192.168.1.250:8080/
HTTPS_PROXY=https://192.168.1.250:8080/
https_proxy=https://192.168.1.250:8080/
no_proxy=localhost,127.0.0.0/8,127.0.1.1
HTTP_PROXY=http://192.168.1.250:8080/

Yo revisaría el ~/.bashrc para que la configuración se aplique automáticamente al iniciar el sistema.

$ man env
$ man set
$ # The file section near the end of the bash manual.
$ man bash 

FILES
       /bin/bash
              The bash executable
       /etc/profile
              The systemwide initialization file, executed for login shells
       /etc/bash.bashrc
              The systemwide per-interactive-shell startup file
       /etc/bash.bash.logout
              The systemwide login shell cleanup file, executed when a login
              shell exits
       ~/.bash_profile
              The personal initialization file, executed for login shells
       ~/.bashrc
              The individual per-interactive-shell startup file
       ~/.bash_logout
              The individual login shell cleanup file, executed when a login
              shell exits
       ~/.inputrc
              Individual readline initialization file
6
6
6
2016-05-03 16:49:09 +0000

Puedes establecer o desestablecer todas las variables a la vez en bash:

$ export {http,https,ftp}_proxy="http://proxy-server:port"
$ unset {http,https,ftp}_proxy

$ export {HTTP,HTTPS,FTP}_PROXY="http://proxy-server:port"
$ unset {HTTP,HTTPS,FTP}_PROXY

También puedes añadir un acceso directo a ti ~/.bashrc:

# Set Proxy
function setproxy() {
    export {http,https,ftp}_proxy="http://proxy-server:port"
    export {HTTP,HTTPS,FTP}_PROXY="http://proxy-server:port"
}

# Unset Proxy
function unsetproxy() {
    unset {http,https,ftp}_proxy
    unset {HTTP,HTTPS,FTP}_PROXY
}

No olvides recargar el .bashrc:

$ . ~/.bashrc

o

$ source ~/.bashrc

Más detalles en [S]hell Hacks.

3
Advertisement
3
3
2013-05-10 13:12:55 +0000
Advertisement
export http_proxy=

Puedes comprobar si han desaparecido ejecutando

echo $http_proxy

Debería devolver una línea en blanco

3
3
3
2011-08-05 06:23:06 +0000

Si quiere cambiar el proxy de los programas de la interfaz gráfica de usuario, puede tener algún éxito si utilizan la configuración del proxy del “sistema” de Gnome. Esta es la configuración del proxy que se puede configurar desde el Panel de Control.

Puede mirar y luego cambiar la configuración actual con gconftool:

$ gconftool-2 -a /system/http_proxy
  ignore_hosts = [localhost,127.0.0.0/8,*.local]
  authentication_user =
  authentication_password =
  use_authentication = false
  use_http_proxy = true
  port = 8080
  host = http://myproxy.mydomain.org/

Para desactivar el proxy - ponga use_http_proxy en false:

$ gconftool-2 -t bool -s /system/http_proxy/use_http_proxy false

Puede comprobar los resultados usando la línea -a de arriba. Alternativamente, para establecer un nuevo proxy:

$ gconftool-2 -t string -s /system/http_proxy/host "http://newproxy.mydomain.org/"
$ gconftool-2 -t int -s /system/http_proxy/port 8088
1
Advertisement
1
1
2016-05-27 07:18:15 +0000
Advertisement

Si todo lo escrito anteriormente no funciona:

  1. Vaya a la configuración del sistema.
  2. Ir a Red.
  3. Ir a network-proxy y aunque la opción seleccionada sea “none”, ir a “manual” y eliminar todos los proxys guardados.
  4. Aplicar a todo el sistema.

¡Esto me ha funcionado!

1
1
1
2018-05-03 22:41:11 +0000

Para desactivar todas las variables proxy en una línea para su sesión actual:

unset `env | grep proxy | cut -d= -f1`
0
Advertisement
0
0
2019-02-07 05:00:29 +0000
Advertisement

Puede eliminar todos los {http_proxy, https_proxy} etc de /etc/environment. simplemente sudo gedit /etc/environment y luego eliminar manualmente todos esos proxies y guardar.

Advertisement

Preguntas relacionadas

11
6
11
9
22
Advertisement
Advertisement