bash shell走socks5代理

之前搭了一个VPS,用的是socks5的协议。chrome上有现成的插件所以一直都可以用,但在bash shell上始终不知道应该怎么通过这个代理来访问网站。
在网上查了一下,bash上配置代理是export两个环境变量

export http_proxy=socks5://127.0.0.1:1080
export https_proxy=socks5://127.0.0.1:1080

但尝试以后发现根本不行,有人说是因为bash shell不支持socks5代理。解决方法主要是再将socks5代理转成http代理,相当于中间再加一层代理。还有一个简单点的办法是用proxychains,估计原理应该是一样的。
步骤如下:
1、安装proxychains

git clone git clone https://github.com/rofl0r/proxychains-ng.git
cd proxychains-ng
./configure
make
sudo make install
sudo make install-config

2、配置
修改/usr/local/etc/proxychains.conf文件
将最后一行改成

socks5 127.0.0.1 1080

即可
3、使用

proxychains4 curl www.google.com

猜你喜欢

转载自blog.csdn.net/u013457310/article/details/82899166