banner
DarianBlog

DarianBlog

达里安博客-专注于技术分享与交流的博客。博客致力于创造一个简单而直接的技术学习平台。
email
telegram

Creating a socks5 proxy script

Testing on Debian 11

#!/bin/bash
# One-click installation script for Socks5 proxy on Debian (based on Dante)
# Usage: sudo bash socks5_install.sh --port=port --user=username --passwd=password

# Install dependencies
apt-get update
apt-get install -y wget gcc make

# Download installation script
wget --no-check-certificate https://raw.github.com/Lozy/danted/master/install.sh -O /tmp/install.sh
chmod +x /tmp/install.sh

# Execute installation
if [ $# -eq 3 ]; then
    /tmp/install.sh "$@"
else
    echo "Usage:"
    echo "sudo bash $0 --port=port --user=username --passwd=password"
    echo "Example: sudo bash $0 --port=1080 --user=admin --passwd=123456"
    exit 1
fi

# Firewall settings
if command -v ufw &> /dev/null; then
    ufw allow $1
    ufw reload
elif command -v iptables &> /dev/null; then
    iptables -A INPUT -p tcp --dport $1 -j ACCEPT
    iptables-save > /etc/iptables.rules
fi

echo "Installation completed!"
echo "Socks5 proxy information:"
echo "Address: $(curl -s ifconfig.me)"
echo "Port: $1"
echo "Username: $2"
echo "Password: $3"

Usage instructions:

Save the above script as socks5_install.sh
Grant execution permission: chmod +x socks5_install.sh
Execute installation: sudo bash socks5_install.sh --port=1080 --user=admin --passwd=123456
(Replace port, username, and password with your own settings)
After installation, the server's external IP and configuration information will be displayed. If you cannot connect, please check the firewall settings and the security group rules of your cloud service provider.

Note:

This script is suitable for Debian 7+/Ubuntu 14.04+ systems
Socks5 is a plaintext proxy and is not recommended for scientific internet access
After installation, you can manage the service with service sockd start/stop/restart
For whitelist restrictions, you can edit the /etc/danted/sockd.conf configuration file.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.