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

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

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

ItistrivialtosetupyourownprivateproxyserveronAmazonEC2,andwithalittleextrawork,aVPNserver....//en.wikibooks.org/w/index.php?title=How_to_Protect_your_Internet_Anonymity_and_Privacy/Your_own_proxy_and_VPN_on_Amazon_EC2&oldid"

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

How to set proxy environment variable in Unix/Linux

2014年6月3日 - How To Use Proxy Server To Access Internet at Shell Prompt With http_proxy ... export http_proxy=http://proxy-server.mycorp.com:3128/ ... How do I use password protected proxy server using various command line options?

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 ...

HowTo : Use a Proxy on the Linux Command Line

Use the following syntax to configure the proxy for http , https and ftp traffic on the Linux command line : $ export http_proxy="http://proxy-server:port"

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 ...

Use PuTTY as a secure proxy on Windows

Last month, I wrote about using OpenSSH as a secure Web proxy on UNIX and Linux systems. This time, I'll show you how to do the same thing on Microsoft Windows using PuTTY ...

linux - setting proxy in wget

2012年6月26日 - You can set the default proxies for Wget to use for http, https, and ftp. ... wget uses environment variables somthing like this at command line ...

Text Mode Use Http Proxy On Linux

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

Links user documentation

Text mode and graphics mode; Using the X-Window graphics system; Other ... Portability on Linux, BSD, Unices in general, OS/2, BeOS, AtheOS, FreeMint, ... HTTP 1.2 as well as HTTP 1.0 support; Tables, frames in both graphics and text mode, ..... If there

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 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 相關文章