Linux-Befehlszeile zum Deaktivieren des Proxys

Können Sie mir die Befehlszeile zeigen, um den Proxy auszuschalten, wenn ich das Befehlszeilenterminal in Ubuntu verwende?

Author: ᔕᖺᘎᕊ, 2010-10-05

8 answers

Wie die andere Antwort sagt, gibt es einige Programme, die das System überhaupt nicht betrachten, Sie müssen sie möglicherweise einzeln einrichten. Zum Beispiel verfügt wget über eine Reihe von Proxy-Optionen, mit denen die Umgebungsproxykonfiguration während der Ausführung ignoriert oder angepasst werden kann. Hier sind einige Bereiche, in denen die Systeme Proxys eingerichtet werden können.

  • Wie mein System aussieht, beachte, dass du wird die spezifizierte ändern müssen systemkonfiguration für Sie Netzwerk-Umgebung.

Einige Linux-Systeme verwenden /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/"  

Es gibt keine einheitliche Einzeleinrichtung andere Verwendung 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/  

Ich würde das ~ / überprüfen.bashrc, um die Einstellung beim Systemstart automatisch angewendet zu haben.

$ 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
 30
Author: nelaaro,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2011-02-21 07:27:47

Angenommen, Sie sprechen von typischer Befehlszeilensoftware und einem HTTP-Proxy:

Die meisten Befehlszeilentools holen dies aus der Umgebungsvariablen HTTP_PROXY, also vor dem Ausführen eines Befehls:

unset HTTP_PROXY

Es kann einige Variationen zwischen Software/Plattformen geben,und Sie müssen möglicherweise auch unset http_proxy.

Beachten Sie, dass viele Programme diese Informationen in ihren eigenen Konfigurationsdateien speichern und die Umgebung wahrscheinlich ignorieren, sodass Sie diese in einem von Fall zu Fall.

 20
Author: ,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2010-10-05 18:10:13

Sie können alle Variablen auf einmal in bash setzen oder aufheben:

$ 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

Sie können Ihnen auch eine Verknüpfung hinzufügen ~/.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
}

Vergiss nicht neu zu laden .bashrc:

$ . ~/.bashrc

Oder

$ source ~/.bashrc

Weitere details unter [S]Hölle Hacks.

 9
Author: Adriano P,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2016-05-03 16:57:45
export http_proxy=

Sie können überprüfen, ob sie weg sind, indem Sie

echo $http_proxy

Es sollte eine leere Zeile zurückgeben

 4
Author: Andrew M.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2013-05-10 13:40:00

Wenn Sie den Proxy für GUI-Programme ändern möchten, haben Sie möglicherweise Erfolg, wenn sie die" System " - Proxy-Einstellungen von Gnome verwenden. Dies sind die Proxy-Einstellungen, die über die Systemsteuerung eingestellt werden können.

Sie können die aktuellen Einstellungen mit gconftool betrachten und dann ändern:

$ 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/

Um den Proxy auszuschalten-setzen Sie use_http_proxy auf false:

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

Sie können die Ergebnisse mit der Zeile -a von oben überprüfen. Alternativ können Sie einen neuen Proxy festlegen:

$ gconftool-2 -t string -s /system/http_proxy/host "http://newproxy.mydomain.org/"
$ gconftool-2 -t int -s /system/http_proxy/port 8088
 3
Author: Greg,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2011-08-05 06:23:06

So deaktivieren Sie alle Proxy-Variablen in einer Zeile für Ihre aktuelle Sitzung:

unset `env | grep proxy | cut -d= -f1`
 2
Author: aruuu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2018-05-03 22:41:11

Wenn alle oben geschriebenen Dinge nicht funktionieren:

  1. Gehe zu den Systemeinstellungen.
  2. Gehe zum Netzwerk.
  3. Gehe zu network-proxy und selbst wenn die ausgewählte Auswahl "none" ist, gehe zu "manual" und entferne alle gespeicherten Proxys.
  4. Gelten systemweit.

Das hat bei mir funktioniert!

 1
Author: Aditi Tayal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2016-05-27 07:23:38

Sie können alle {http_proxy, https_proxy} usw. aus /etc/environment löschen. nur sudo gedit /etc/environment und dann löschen Sie manuell alle diese Proxys und speichern.

 0
Author: Ranjeet Kumar Upadhyay,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2019-02-07 05:00:29