Text Mode Use Http Proxy On Linux
Text Mode Use Http Proxy On Linux

Linux上沒有用過的東西實在太多太多,過年期間裝了Ubuntu後要開始慢慢玩了,因為我選擇先安裝在我的x60上面,而x60又有需求上班時使用,所以對於連線方式要...

HowTo : Use a Proxy on the Linux Command Line

Usethefollowingsyntaxtoconfiguretheproxyforhttp,httpsandftptrafficontheLinuxcommandline:$exporthttp_proxy="http://proxy-server:port"

** 本站引用參考文章部分資訊,基於少量部分引用原則,為了避免造成過多外部連結,保留參考來源資訊而不直接連結,也請見諒 **

Text Mode Use Http Proxy On Linux

Linux 上沒有用過的東西實在太多太多,過年期間裝了Ubuntu 後要開始慢慢玩了,因為我選擇先...

Linux

... Squid Proxy authentication in a transparent mode You cannot use Squid authentication with a transparently intercepting proxy. Further reading: How do I use Iptables connection tracking feature? ...

Proxy settings - ArchWiki

... { PROXY_ENV="http_proxy ftp_proxy https_proxy all_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY ALL_PROXY" for envar in $PROXY_ENV do export $envar=$1 done for envar in "no_proxy NO_PROXY " do export $envar=$2 done } clrProxy ...

SSH Tunnel On Linux Over Http Proxy

使用的方式大家可以到官方頁面去參考,相信裡面的資訊應該是挺豐富的,我這裡要回到主題上的 SSH Tunnel On Linux Over Http Proxy,前一篇文章有提到 Text Mode Use Http Proxy On Linux ,若設定 ssh 利用 http_proxy 來連線有前篇文章簡單就好了,可惜就是 ...

How to Protect your Internet Anonymity and Privacy/Your own proxy and VPN on Amazon EC2

It is trivial to setup your own private proxy server on Amazon EC2, and with a little extra work, a VPN server. ... //en.wikibooks.org/w/index.php?title=How_to_Protect_your_Internet_Anonymity_and_Privacy/Your_own_proxy_and_VPN_on_Amazon_EC2&oldid&quot

ubuntu - Linux command line to turn off proxy

2010年10月5日 - As the other answer says there are some programs that don't look at the system at all you may have to set them up individually. For instance ...

apt - Setting proxy from terminal

2012年7月2日 - I have tried setting the proxy via bashrc file but that din work either. ... See https://help.ubuntu.com/community/EnvironmentVariables for details.

How To Set A Proxy For The Terminal [Quick Linux Tip] ~ Web Upd8 ...

2010年10月11日 - Here is an example. If you've set up TOR and you want to use it for the terminal, to set a HTTP and HTTPS proxy for the current terminal session ...

10. Using yum with a Proxy Server

Using yum with a Proxy Server By default, yum accesses network repositories with HTTP. All yum HTTP operations use HTTP/1.1, and are compatible with web proxy servers that support this standard. You may also access FTP repositories, and configure ...

How to Set the http_proxy Variable in Linux

How to Set the http_proxy Variable in Linux The following information will teach you how to allow your Linux system to use a proxy server for command line tools like wget and yum. The http_proxy variable tells the system what proxy server it should used t


Text Mode Use Http Proxy On Linux

Text Mode Use Http Proxy On Linux

Linux 上沒有用過的東西實在太多太多,過年期間裝了 Ubuntu 後要開始慢慢玩了,因為我選擇先安裝在我的 x60 上面,而 x60 又有需求上班時使用,所以對於連線方式要開始一些設定,當然這裡只是說一些基本的設定,太高深的技巧我也不會啦!

若只是透過瀏覽器上網,那麼瀏覽器上的設定填一填就好,這個設定我想大家應該都會吧!要介紹給大家怎樣設定嗎?應該是不用吧!對我來說第一次研究的是該如何在 text mode 上透過 http proxy 連上線。

先示範一般狀況下載一張圖片
$ wget https://host.easylife.tw/pics/200802/0212/DSC02029.jpg
--19:33:52--  https://host.easylife.tw/pics/200802/0212/DSC02029.jpg
           => `DSC02029.jpg'
正在查找主機 pic.easylife.idv.tw... 211.76.137.37
正在連接 pic.easylife.idv.tw

211.76.137.37

:80... 連上了。
已送出 HTTP 要求,正在等候回應... 200 OK
長度: 81,898 (80K) [image/jpeg]

100%[====================================>] 81,898        56.93K/s            

19:33:55 (56.82 KB/s) -- 已儲存 ‘DSC02029.jpg’ [81898/81898])
這不用解釋太多,基本的 wget 指令下載一張圖片。

透過 http proxy 下載一張圖片
$ export http_proxy=http://proxy.hinet.net:80
這部份是設定 http_proxy,如同我們想要做的一樣,指令很直接,只是沒用過怎會知道呢?
$ wget https://host.easylife.tw/pics/200802/0212/DSC02029.jpg
--19:39:11--  https://host.easylife.tw/pics/200802/0212/DSC02029.jpg
           => `DSC02029.jpg.1'
正在查找主機 proxy.hinet.net... 61.219.36.250, 61.219.36.120
正在連接 proxy.hinet.net

61.219.36.250

:80... 連上了。

已送出 Proxy 要求,正在等候回應... 200 OK
長度: 81,898 (80K) [image/jpeg]

100%[====================================>] 81,898       450.47K/s            

19:39:11 (449.55 KB/s) -- 已儲存 ‘DSC02029.jpg.1’ [81898/81898])
在下載一次圖片,如同所設定的透過了 http_proxy。

其實簡易的設定就是如此
export http_proxy=http://代理伺服器:port
這樣方式的設定其實也是可以利用在 ftp 上面
export ftp_proxy=http://代理伺服器:port
若經過的代理伺服器是需要帳號密碼的,那麼也是最一般的方式就可以解決
export http_proxy=http://帳號:密碼@代理伺服器:port

只是透過指令殘留下帳號密碼的資訊其實不是一個好作法,若有人查詢你的歷史紀錄密碼就曝光了,於是我們可以簡單的利用環境變數來建立一個 fuction
增加下列的內容到個人家目錄裡的 .bashrc
function useproxy(){
        echo -n "username:"
        read -e username
        echo -n "password:"
        read -es password
        if [ $username ] && [ $password ]; then
                export http_proxy="http://$username:[email protected]:80"
                export ftp_proxy="http://$username:[email protected]:80"
        else
                export http_proxy="proxy.hinet.net:80"
                export ftp_proxy="proxy.hinet.net:80"
        fi
}
之後來測試一下囉,重新開一個視窗來讓 .bashrc 生效比較快
$ useproxy
username:
password:
$ set

grep proxy

ftp_proxy=proxy.hinet.net:80
http_proxy=proxy.hinet.net:80
若沒有密碼狀況如上,若加上帳號密碼狀況如下
$ useproxy
username:wawa
password:
$ set

grep proxy

ftp_proxy=http://wawa:[email protected]:80
http_proxy=http://wawa:[email protected]:80
當然看環境變數還是可以看到帳號密碼的,只是不會留在歷史紀錄裡。

一切就是這麼簡單而已,但是哪有多少然和我一樣習慣用 command 啊~既然都使用視窗介面當然也會有視窗的設定,但是我還是只告訴你 Ubuntu 裡的 command
$ kcmshell proxy
因為怎麼設定我也懶得去研究,若所有連線都得透過 proxy 那麼這環境還真是令人錯愕。

Text Mode Use Http Proxy On Linux
哇哇
哇哇

Text Mode Use Http Proxy On Linux 相關文章