主要参考该篇文章,为了防止文章丢失,转载至此。
注意
在进行./configure
时在MAC下可能会错误,这个在别的教程中几乎没有提及,这里的做法是:
./configure --host=apple
Tunnel SSH through a proxy on MacOS X Mountain Lion
Until recently my workplace allowed direct ssh traffic to pretty much anywhere. They recently blocked this, which makes sense from a security point of view but is very inconvenient at times. Luckily it is pretty easy to tunnel ssh through our http proxy so I can still get to external hosts and they can still monitor what I am doing. The first step is to install Xcode if you haven't already. In Mountain Lion, Xcode is now available through the Mac App Store. After you've installed Xcode, you'll need to install the command line tools. Launch Xcode and go to Preferences > Downloads to install the command line tools.
Next, download corkscrew. The corkscrew README has more or less everything you need to know from here, but the basic procedure is to launch Terminal and then enter the following commands:
cd ~/Downloads
tar -xfv corkscrew-2.0.tar
cd corkscrew-2.0
./configure --host=apple
The configure command is the only part that varies from the README. Without specifying the host I was getting an error "configure: error: can not guess host type; you must specify one". After configure is done, then run two more commands.
make
sudo make install
Next you will need to create the file ~/.ssh/config if it doesn't already exist and add the following lines, where proxy.example.com is your proxy server and 8080
is the port it is listening on:
ProxyCommand /usr/local/bin/corkscrew proxy.example.com 8080 %h %p
If your proxy requires authentication like mine then you need to modify your ~/.ssh/config
slightly.
Host *
ProxyCommand corkscrew proxy.com 8888 %h %p
网友评论