banner
DarianBlog

DarianBlog

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

一件創建socks5代理腳本

測試於 debian11

#!/bin/bash
# Debian一鍵安裝Socks5代理腳本 (基於Dante)
# 使用方法: sudo bash socks5_install.sh --port=端口 --user=用戶名 --passwd=密碼

# 安裝依賴
apt-get update
apt-get install -y wget gcc make

# 下載安裝腳本
wget --no-check-certificate https://raw.github.com/Lozy/danted/master/install.sh -O /tmp/install.sh
chmod +x /tmp/install.sh

# 執行安裝
if [ $# -eq 3 ]; then
    /tmp/install.sh "$@"
else
    echo "使用方法:"
    echo "sudo bash $0 --port=端口 --user=用戶名 --passwd=密碼"
    echo "示例: sudo bash $0 --port=1080 --user=admin --passwd=123456"
    exit 1
fi

# 防火牆設置
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 "安裝完成!"
echo "Socks5代理信息:"
echo "地址: $(curl -s ifconfig.me)"
echo "端口: $1"
echo "用戶名: $2"
echo "密碼: $3"

使用說明:

將上述腳本保存為 socks5_install.sh
給予執行權限:chmod +x socks5_install.sh
執行安裝:sudo bash socks5_install.sh --port=1080 --user=admin --passwd=123456
(將端口、用戶名和密碼替換為你自己的設置)
安裝完成後會顯示伺服器外網 IP 和配置信息。如果連接不上,請檢查防火牆設置和雲服務商的安全組規則。

注意:

此腳本適用於 Debian 7+/Ubuntu 14.04 + 系統
Socks5 是明文代理,不建議用於科學上網
安裝完成後可通過 service sockd start/stop/restart 管理服務
如需白名單限制,可編輯 /etc/danted/sockd.conf 配置文件

載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。