Setting Up proxychains-ng With an Authenticated SOCKS5 Proxy
By the ProxyV4 Engineering Team · Updated:
To use proxychains with a SOCKS5 username and password, add a line in the form socks5 IP PORT USER PASS under [ProxyList] in your proxychains config, then run proxychains4 your-command. The rest of this guide covers which config file wins, what proxy_dns really does, when to pick strict_chain or dynamic_chain, and the programs proxychains can never wrap, starting with Go binaries.
Install proxychains-ng, not the old proxychains
The original proxychains 3.x has been unmaintained for years. proxychains-ng is the active fork, and its command is proxychains4. Package names differ by platform:
sudo apt install proxychains4 # Debian, Ubuntu
sudo dnf install proxychains-ng # Fedora (EPEL on RHEL-family)
sudo pacman -S proxychains-ng # Arch
brew install proxychains-ng # macOSIt works by preloading a small library into the program you launch. That library intercepts the network calls the program makes through the C library and reroutes them through your proxy list. The mechanism explains both why it works with almost any CLI tool and why some tools escape it, which we cover further down.
Which proxychains4.conf gets used
proxychains-ng stops at the first readable file in this order: the path given with -f, the PROXYCHAINS_CONF_FILE environment variable, proxychains.conf in the current directory, ~/.proxychains/proxychains.conf, and finally the system file. Debian and Ubuntu packages install the system file as /etc/proxychains4.conf.
Editing the system file affects every user and needs root. A per-user copy is cleaner, keeps your proxy password out of a world-readable file, and is picked up automatically:
mkdir -p ~/.proxychains
cp /etc/proxychains4.conf ~/.proxychains/proxychains.conf
chmod 600 ~/.proxychains/proxychains.confFor one-off runs against a different proxy, keep separate files and pass them explicitly with proxychains4 -f ~/proxies/uk.conf curl .... Explicit beats clever when you come back to a script months later.
Writing the SOCKS5 line with username and password
The [ProxyList] section must come last in the file. Each line holds a type, a numeric IPv4 address, a port and optionally a user name and password, separated by spaces or tabs. Supported types are socks5, socks4, http and raw; SOCKS5 uses username and password login, HTTP uses Basic authentication.
[ProxyList]
# type ip port user pass
socks5 203.0.113.10 PORT USER PASSRemove or comment out the default socks4 127.0.0.1 9050 entry that ships in the file, or with strict_chain every connection is chained through a local Tor port first and fails.
Converting an ip:port:user:pass line
Providers usually deliver credentials as one colon-separated string. A short shell snippet turns it into a ProxyList entry without retyping the password:
line='203.0.113.10:PORT:USER:PASS'
IFS=: read -r ip port user pass <<< "$line"
printf 'socks5\t%s\t%s\t%s\t%s\n' "$ip" "$port" "$user" "$pass" >> ~/.proxychains/proxychains.confIf you need the same line as a URL for other tools, the proxy format converter handles that.
Characters the format cannot hold
Because fields are split on whitespace, a password containing a space or tab cannot be expressed. Unlike URL-based tools, no percent-encoding is needed for @, : or # here; they are taken literally. The shipped config also states that only numeric IPv4 proxy addresses are valid, so use the IP rather than a hostname.
proxy_dns and the 224.x.x.x addresses
With proxy_dns enabled, as it is in the shipped config, proxychains does not send your DNS queries anywhere. When the program asks for a hostname, the library returns a placeholder address from the remote_dns_subnet range, 224.x.x.x by default, and remembers the name. When the program then connects to that placeholder, proxychains hands the real hostname to the SOCKS5 proxy, which resolves it on its side.
Two consequences follow. Your local resolver never sees the lookup, and tools that print the resolved address will show a strange 224. IP, which is expected. Also, localnet exclusions only work on real IP addresses, so with proxy_dns on, an exclusion for an internal hostname will not match; use the internal IP directly. Separately, if a program misbehaves with the threaded resolver, try proxy_dns_old or proxy_dns_daemon.
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet 10.0.0.0/255.0.0.0strict_chain vs dynamic_chain (and the other two)
Only one chain type may be active; if several are uncommented, the last one wins. With a single proxy in the list, all four behave the same, so this choice matters only once you add more lines.
- Chaining two authenticated proxies multiplies latency and failure points. Use one hop unless you have a specific reason.
- With
dynamic_chain, a silent failover can change your exit IP. If a remote service expects one address, stay onstrict_chain.
| Chain type | What it does | When to use it |
|---|---|---|
| strict_chain | Uses every proxy in list order; any dead proxy fails the connection | You need a predictable exit, such as one fixed IP a server trusts |
| dynamic_chain | Uses the list in order but skips dead entries | Failover between two or more equivalent proxies |
| round_robin_chain | Starts each new chain at the next proxy, chain_len long | Spreading separate connections over several IPs |
| random_chain | Picks chain_len random proxies per connection | Testing; rarely useful for real work |
Where one authenticated SOCKS5 line fits
proxychains shines when a command-line tool has no proxy option and you need its traffic to leave from a specific, stable address: a database client reaching a managed database firewalled to one IP, a legacy sync tool talking to a partner's server, or a test that must run from a given country. One private SOCKS5 proxy with a fixed IP is exactly that.
ProxyV4 private datacenter IPv4 proxies provide one tenant per IP for the whole term, in the United States, Vietnam, Japan, South Korea, Singapore, the United Kingdom and Hong Kong. Every proxy supports SOCKS5 and HTTP(S) with username and password, matching the socks5 and http ProxyList types, and both can share one port. Traffic is not metered, the IP stays the same while active, and renewing before expiry keeps it.
Where it does not fit: anything that needs UDP (ask support through a ticket before ordering if you depend on it), and anything that needs a new IP per request, since rotating proxies are not on sale. Order a single IP, run your real command through it, and see live per-IP prices on the pricing page.
Programs proxychains cannot wrap
Most surprises come from programs that never call the C library functions proxychains hooks. They run, connect directly, and nothing warns you.
Go binaries and statically linked tools
Preloading only works on dynamically linked programs that open sockets through libc. Go programs make system calls directly, so kubectl, terraform, gh, docker (the CLI) and many other Go tools bypass proxychains entirely. The same is true for fully static binaries, for example many musl builds. Check with file $(which tool): "statically linked" means proxychains has no effect.
The fix is usually easier than wrapping: Go's standard HTTP client honors HTTPS_PROXY and NO_PROXY, so HTTPS_PROXY=http://USER:[email protected]:PORT kubectl get pods covers most of these tools.
setuid programs, sudo and macOS system binaries
The dynamic loader ignores preloaded libraries for setuid programs, and sudo cleans the environment as well. Write sudo proxychains4 cmd, not proxychains4 sudo cmd. On macOS, System Integrity Protection strips the injection variable from binaries under /usr/bin, so use a Homebrew build of curl or other tools.
UDP and ICMP
proxychains handles TCP only. ping (ICMP), traditional DNS clients like dig that talk UDP to a resolver, and UDP-based protocols are not proxied, so proxychains4 ping example.com tells you nothing about the proxy.
Confirming the exit IP
Run a command that reports the address the outside world sees, with and without proxychains, and compare. The -q flag hides the library's chain log; drop it while debugging, since the log shows each hop and whether it returned OK.
curl -s https://ifconfig.me; echo
proxychains4 -q curl -s https://ifconfig.me; echo
proxychains4 curl -sI https://example.com # verbose chain logIf the proxied run hangs and then fails, test the proxy line itself with the proxy checker before editing the config further. For tools that read environment variables and services managed by systemd, a system-wide setup like the Ubuntu proxy guide is often a better long-term answer than wrapping each command.
Frequently asked questions
What is the proxychains SOCKS5 syntax with a username and password?
Under [ProxyList], write socks5 IP PORT USER PASS with spaces or tabs between fields, for example socks5 203.0.113.10 PORT USER PASS.
Why does proxychains show 224.x.x.x addresses?
Those are placeholders from remote_dns_subnet used by proxy_dns. The real hostname is sent to the proxy to resolve, so the placeholder never leaves your machine.
Why doesn't proxychains work with kubectl or terraform?
They are Go programs that bypass the C library calls proxychains intercepts. Set HTTPS_PROXY for them instead.
Should I use strict_chain or dynamic_chain with one proxy?
It makes no difference with one entry. With several, strict_chain keeps the exit predictable and dynamic_chain skips dead proxies.
Does a ProxyV4 proxy work as both socks5 and http in proxychains?
Yes. Each order can run HTTP only, SOCKS5 only, or both on one port with the same username and password. Switching modes can move the proxy to a new port, so copy the line again afterwards.
Wrap any Linux CLI in an authenticated SOCKS5 line
Get a private IPv4 with SOCKS5 and HTTP(S) login, unmetered traffic and an IP that stays the same while active. Order one, test your command, then scale.
Try one private IP