I’ve been trying to set up a SOCKS5 proxy on my Ubuntu terminal, and honestly, it’s turning out to be more challenging than I imagined. I’ve done a bit of research, and it seems like there are various ways to approach this, but I’m getting a bit lost in the process.
I think I need to configure the proxy settings properly so I can route my terminal requests through it. One of my friends mentioned using a service like Shadowsocks, which supposedly has a SOCKS5 proxy feature, but I have no idea where to start. Should I install Shadowsocks or is there another way to do this? I’ve also seen some mentions of using something like ssh -D, but I’m not sure how to set that up either.
If I go the Shadowsocks route, what exactly do I need to do after installing it? Is there a specific configuration file I need to edit? Like, do I put in the server address, port numbers, and any credentials? And then, how do I actually tell Ubuntu to use this proxy for all my terminal commands? I’ve been looking at a few tutorials online, but they keep skipping steps, probably assuming a level of familiarity that I just don’t have.
On the other hand, if I try using the SSH method, how do I establish that connection? Do I need to have an SSH server set up somewhere? And once I set that up, what are the command prompts I need to keep in mind? I imagine I’d also need to export some environment variables so that the terminal knows to use the SOCKS5 proxy I set up, but again, I could use some detailed guidance on how to do that.
If anyone has a step-by-step walkthrough or some solid resources on this, I’d really appreciate it. I’m just looking for a clear path to get SOCKS5 working on my Ubuntu terminal without getting too deep into the weeds or accidentally breaking something. Thanks in advance for any help!
How to Set Up a SOCKS5 Proxy on Ubuntu
First off, no worries! Setting up a SOCKS5 proxy can definitely feel overwhelming at first, but let’s break it down step by step.
Option 1: Using Shadowsocks
If you decide to go the Shadowsocks route, here’s what you need to do:
Create a file called
config.json
in your home directory:Next, edit it to look something like this:
Make sure to replace
your_server_ip
,your_port
, andyour_password
with the actual values.Setting Up Ubuntu to Use the SOCKS5 Proxy
To route your terminal requests through the SOCKS5 proxy:
This tells your terminal to route all requests through the SOCKS5 proxy running on localhost.
Option 2: Using SSH -D
If you prefer using SSH for setting up a SOCKS5 proxy:
Exporting Environment Variables
Just like with Shadowsocks, to set your terminal to use this proxy, run:
Final Notes
Remember, whenever you open a new terminal session, you’ll need to set the
ALL_PROXY
variable again. You can add the export command to your.bashrc
or.bash_profile
to make it permanent:Then, run
source ~/.bashrc
to apply the changes.Just keep experimenting with it, and don’t hesitate to ask for help in forums if you’re still stuck. Good luck!
To set up a SOCKS5 proxy on your Ubuntu terminal, you have two main options: using Shadowsocks or utilizing SSH’s built-in functionality. If you choose Shadowsocks, first install it using the command
sudo apt install shadowsocks
. After installation, you need to create a configuration file, typically located at/etc/shadowsocks.json
. In that file, you will specify the server address, server port, local port (usually 1080 for SOCKS5), and the password for authentication. The configuration should look something like this:You can run Shadowsocks with the command
ssserver -c /etc/shadowsocks.json
. To route your terminal requests through the SOCKS5 proxy, you may need to export environment variables. Useexport SOCKS5_PROXY="socks5://127.0.0.1:1080"
to tell applications that support proxy settings to use this. Alternatively, if you opt for the SSH method, you would need an SSH server. Once you have access to a remote server, you can establish the SOCKS5 proxy with the commandssh -D 1080 user@your_server
, replacinguser
andyour_server
with your information. Again, set theSOCKS5_PROXY
variable as mentioned above. Following these steps should help you configure and utilize a SOCKS5 proxy in your Ubuntu terminal effectively.