March 10, 2025

How to Set Up Microsocks on Ubuntu: A Lightweight SOCKS5 Proxy

Microsocks is a minimalistic, lightweight SOCKS5 proxy that allows you to relay network traffic securely and efficiently. Whether you need a simple proxy solution for privacy, testing, or bypassing network restrictions, Microsocks is a great choice due to its small footprint and ease of use.

This guide will walk you through the installation and configuration of Microsocks on an Ubuntu system.

Why Use Microsocks?

  • Lightweight – It uses minimal system resources.
  • Simple Configuration – No complex setup is required.
  • Fast & Efficient – Ideal for handling basic proxying needs.
  • Open Source – Available on GitHub with transparent code.

Step 1: Install Microsocks

Since Microsocks is not available in Ubuntu’s default repositories, we will install it from source.

1.1 Install Required Dependencies

Before downloading Microsocks, ensure you have the necessary tools installed:

sudo apt update
sudo apt install git build-essential

1.2 Clone the Microsocks Repository

Next, clone the official Microsocks repository from GitHub:

git clone https://github.com/rofl0r/microsocks.git
cd microsocks

1.3 Compile and Install Microsocks

Run the following command to compile the software:

make

This will generate a microsocks binary in the current directory.

To install it system-wide, move the binary to /usr/local/bin/:

sudo cp microsocks /usr/local/bin/

Step 2: Run Microsocks

Now that Microsocks is installed, you can run it manually with:

microsocks -p 1080

This starts the SOCKS5 proxy on port 1080.

To specify an IP address for binding (e.g., if you have multiple interfaces), use:

microsocks -i 192.168.1.100 -p 1080

Step 3: Configure Microsocks as a Systemd Service (Optional)

For convenience, you can set up Microsocks as a systemd service so that it runs automatically at startup.

3.1 Create a Systemd Service File

Create a new service file:

sudo nano /etc/systemd/system/microsocks.service

Add the following content:

[Unit]
Description=Lightweight SOCKS5 Proxy - Microsocks
After=network.target

[Service]
ExecStart=/usr/local/bin/microsocks -p 1080
Restart=always
User=nobody
Group=nogroup

[Install]
WantedBy=multi-user.target

Save and exit (CTRL+X, then Y, and Enter).

3.2 Enable and Start the Service

Run the following commands to enable and start the Microsocks service:

sudo systemctl daemon-reload
sudo systemctl enable microsocks
sudo systemctl start microsocks

To check the status:

sudo systemctl status microsocks

Step 4: Test the Proxy

To test your SOCKS5 proxy, use curl:

curl --proxy socks5h://localhost:1080 -I https://www.example.com

If you see a valid HTTP response, your proxy is working.

Step 5: Configure Applications to Use the Proxy

You can configure browsers, SSH, or other applications to use your SOCKS5 proxy. For example, to use SSH over SOCKS5:

ssh -o ProxyCommand="nc -X 5 -x localhost:1080 %h %p" user@remotehost

Conclusion

Microsocks provides a simple, lightweight way to set up a SOCKS5 proxy on Ubuntu. With minimal setup and resource usage, it’s ideal for those needing a quick and efficient proxy solution. By setting it up as a systemd service, you ensure it runs automatically without manual intervention.

Have questions or need further assistance? Let us know in the comments!