Need a lightweight SOCKS5 proxy on a cheap VPS without wrestling with Dante configs, PAM files, and firewall rules? selfhostedSocks5 is an open-source Bash script that installs, secures, and manages a Dante-based SOCKS5 proxy on Debian, Ubuntu, and Alpine Linux in one command.
It is built for extreme low-end environments: 64MB/128MB RAM nodes, LXC containers, and micro-VPS deals where a normal package install would trip the OOM killer. The script handles swap allocation during install, strips log bloat, and ships with SSRF protection so proxy users cannot reach loopback, private networks, or cloud metadata endpoints.
A SOCKS5 proxy establishes a TCP connection to a remote server on behalf of a client and relays traffic between them. Unlike a full VPN tunnel, a SOCKS proxy is application-level and lightweight, useful for routing specific traffic through another host, bypassing restrictive networks, or testing from a different egress IP. For many use cases it is simpler and faster to deploy than a VPN.
apk and OpenRC.127.0.0.0/8, private RFC1918 ranges, and cloud metadata IPs.Debian & Ubuntu:
wget -qO socks5.sh https://raw.githubusercontent.com/mathewskdaniel/selfhostedSocks5/main/socks5.sh && sudo bash socks5.sh
Alpine Linux:
wget -qO alpinesocks5.sh https://raw.githubusercontent.com/mathewskdaniel/selfhostedSocks5/main/alpinesocks5.sh && sudo ash alpinesocks5.sh
On minimal containers running as root without sudo, drop the sudo prefix. After install, the script prints your server IP, port, username, and password. Save the password immediately; hashes are irreversible.
Re-run the script anytime to open the SOCKS5 Master Manager:
╔══════════════════════════════════╗
║ SOCKS5 Master Manager ║
╠══════════════════════════════════╣
║ Status: Running ║
║ IP: 192.168.69.42 ║
║ Port: 44321 ║
╠══════════════════════════════════╣
║ 1) List Users ║
║ 2) Add New User ║
║ 3) Remove a User ║
║ 4) Change Global Port ║
║ 5) Full Uninstall ║
║ 6) Exit ║
╚══════════════════════════════════╝
Source, issues, and updates: github.com/mathewskdaniel/selfhostedSocks5 (MIT License).
All rights reserved