프록시를 끄는 Linux 명령 행 이주했습니다 .

우분투에서 커맨드 라인 터미널을 사용할 때 프록시를 끄는 커맨드 라인을 보여줄 수 있습니까?



답변

다른 답변에 따르면 시스템을 전혀 보지 않는 일부 프로그램이 있습니다. 개별적으로 설정해야 할 수도 있습니다. 예를 들어 wget에는 실행 중에 환경 프록시 구성을 무시하거나 적용하는 데 사용할 수있는 여러 프록시 옵션이 있습니다. 다음은 시스템 프록시를 설정할 수있는 여러 영역입니다.

  • 내 시스템의 모습, 네트워킹 환경에 대해 지정된 시스템 구성을 변경해야합니다.

일부 Linux 시스템은 / 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/"  

균일 한 단일 설정 다른 사용 환경이 없습니다

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

시스템 시작시 설정이 자동으로 적용되도록 ~ / .bashrc를 확인하십시오.

$ 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


답변

일반적인 명령 줄 소프트웨어와 HTTP 프록시에 대해 이야기한다고 가정합니다.

대부분의 명령 행 도구 HTTP_PROXY는 명령을 실행하기 전에 환경 변수에서이를 선택합니다 .

unset HTTP_PROXY

소프트웨어 / 플랫폼간에 약간의 차이가있을 수 있으며 unset http_proxy또한 필요할 수도 있습니다.

많은 프로그램이이 정보를 자체 구성 파일에 저장하므로 환경을 무시할 가능성이 있으므로 상황에 따라이를 해결해야합니다.


답변

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

바로 가기를 추가 할 수도 있습니다 ~/.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
}

.bashrc를 다시로드하는 것을 잊지 마십시오.

$ . ~/.bashrc

또는

$ source ~/.bashrc

[S] hell Hacks에 대한 자세한 내용 .


답변

GUI 프로그램의 프록시를 변경하려는 경우 Gnome의 “시스템”프록시 설정을 사용하면 성공할 수 있습니다. 제어판에서 설정할 수있는 프록시 설정입니다.

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/

프록시를 끄려면 use_http_proxy를 false로 설정하십시오.

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

-a위 의 줄을 사용하여 결과를 확인할 수 있습니다 . 또는 새 프록시를 설정하려면

$ gconftool-2 -t string -s /system/http_proxy/host "http://newproxy.mydomain.org/"
$ gconftool-2 -t int -s /system/http_proxy/port 8088


답변

export http_proxy=

당신은 그들이 실행하여 사라 졌는지 확인할 수 있습니다

echo $http_proxy

빈 줄을 반환해야합니다


답변

위에 쓰여진 모든 것이 작동하지 않는 경우 :

  1. 시스템 설정으로 이동하십시오.
  2. 네트워크로 이동하십시오.
  3. 네트워크 프록시로 이동하여 선택한 항목이 “없음”인 경우에도 “수동”으로 이동하여 저장된 프록시를 모두 제거하십시오.
  4. 시스템 전체에 적용하십시오.

이것은 나를 위해 일했다!


답변

현재 세션에 대해 한 줄에서 모든 프록시 변수를 비활성화하려면 :

unset `env | grep proxy | cut -d= -f1`