On GNU/Linux, it is easy to create SOCKS proxies using programs such as ssh or tor. However, many applications on GNU/Linux, such as LibreOffice and genymotion (up to the date on which this post is written), can be configured to directly use HTTP proxies (or web proxies), but not SOCKS proxies. In this post, we will use privoxy, a non-cache web proxy, to enable these applications to use SOCKS proxies.
First, we need to install privoxy. This can be done by using one of the following commands:
sudo apt-get install privoxy
sudo dnf install privoxyor
sudo yum install privoxy
Then, we need to configure privoxy by editing
sudo nano /etc/privoxy/config
Here, you can replace
nano with your favorite editor. Assuming that a SOCKS proxy is available at localhost on port 12345 (e.g., started by
ssh -D 12345 remote-host), append
forward-socks5 / localhost:12345 .
to the end of this file. (Certainly, you should replace
localhost:12345 with your targeted SOCKS proxy). This will set privoxy to convert all HTTP traffic into
localhost:8118 to SOCKS 5 traffic into
localhost:12345. To use SOCKS 4, replace
forward-socks4. For more details, check out the privoxy manual.
Next, we need to start privoxy (or restart if privoxy has already been started). To do this, run
sudo systemctl reload-or-restart privoxy
To always start privoxy upon system startup, run
sudo systemctl enable privoxy
Now you should be able to configure applications to use the targeted SOCKS proxy (
localhost:12345 in our example) by setting
localhost:8118 as their HTTP proxy.
Join To Our Newsletter
You are welcome