Set a proxy for terminal on Ubuntu

本文介绍如何通过SSH建立SOCKS代理,并配置Privoxy进行全局流量代理的方法。首先,通过SSH命令创建一个SOCKS代理;其次,安装并配置Privoxy以使用该SOCKS代理;最后,设置环境变量使所有HTTP请求都通过Privoxy转发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

First:
$ ssh -D 8080 user@remote_server_ip

For example:$ ssh -D 8080 root@172.104.51.239

(you can also use ***-qt5)



Second:

$ sudo apt install privoxy

vi /etc/privoxy/config
Add these two lines:

forward-socks5 / 127.0.0.1:8080 .

forward-socks4 / 127.0.0.1:8080 .

 

You can use the following command to check which port is using :
$ sudo netstat -ntlp | grep LISTEN
You can find port 8080 is on
and used by privoxy.


Third:

Open a terminal:

$ export ALL_PROXY=http://127.0.0.1:8118


Test:

use this to find if your proxy is working:

$ curl -v google.com



Besides: I find a tool to check whether the server ip is blocked, sometimes may useful:
ping.pe

转载于:https://www.cnblogs.com/readingstuff/p/9497610.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值