0


Ubuntu/Debian/CentOS搭建Socks5代理一键脚本

说明

Socks5

属于明文代理,不要用于科学上网,否则会被阻断端口,可用于正常的跳板使用;
比如

SSH

转发加速国外

VPS

的连接速度,特别是一些延迟高或者丢包高的

VPS


使用

Socks5

转发后

SSH

就可以快速稳定的连接了,解决高丢包

SSH

断开的问题;

支持

支持系统

Debian7+
Ubuntu14.04+
CentOS6+

安装

下载脚本

wget --no-check-certificate https://raw.github.com/Lozy/danted/master/install.sh -O install.sh

https://raw.github.com/Lozy/danted/master/install.sh

#!/bin/bash
#
#   Dante Socks5 Server AutoInstall
#   -- Owner:       https://www.inet.no/dante
#   -- Provider:    https://sockd.info
#   -- Author:      Lozy
#

# Check if user is root
if [ $(id -u) != "0" ]; then
    echo "Error: You must be root to run this script, please use root to install"
    exit 1
fi

REQUEST_SERVER="https://raw.github.com/Lozy/danted/master"
SCRIPT_SERVER="https://public.sockd.info"
SYSTEM_RECOGNIZE=""

[ "$1" == "--no-github" ] && REQUEST_SERVER=${SCRIPT_SERVER}

if [ -s "/etc/os-release" ];then
    os_name=$(sed -n 's/PRETTY_NAME="\(.*\)"/\1/p' /etc/os-release)

    if [ -n "$(echo ${os_name} | grep -Ei 'Debian|Ubuntu' )" ];then
        printf "Current OS: %s\n" "${os_name}"
        SYSTEM_RECOGNIZE="debian"

    elif [ -n "$(echo ${os_name} | grep -Ei 'CentOS')" ];then
        printf "Current OS: %s\n" "${os_name}"
        SYSTEM_RECOGNIZE="centos"
    else
        printf "Current OS: %s is not support.\n" "${os_name}"
    fi
elif [ -s "/etc/issue" ];then
    if [ -n "$(grep -Ei 'CentOS' /etc/issue)" ];then
        printf "Current OS: %s\n" "$(grep -Ei 'CentOS' /etc/issue)"
        SYSTEM_RECOGNIZE="centos"
    else
        printf "+++++++++++++++++++++++\n"
        cat /etc/issue
        printf "+++++++++++++++++++++++\n"
        printf "[Error] Current OS: is not available to support.\n"
    fi
else
    printf "[Error] (/etc/os-release) OR (/etc/issue) not exist!\n"
    printf "[Error] Current OS: is not available to support.\n"
fi

if [ -n "$SYSTEM_RECOGNIZE" ];then
    wget -qO- --no-check-certificate ${REQUEST_SERVER}/install_${SYSTEM_RECOGNIZE}.sh | \
        bash -s -- $*  | tee /tmp/danted_install.log
else
    printf "[Error] Installing terminated"
    exit 1
fi

exit 0

安装脚本

bash install.sh  --port=端口 --user=用户名 --passwd=密码

其中的

端口
用户名
密码

自行修改后粘贴到

SSH

里运行安装即可;
完成后会提示

Dante Server Install Successfuly

即表示安装成功;
安装后如果连接不上,检查设置的端口是否已经放行;
说明:安装完成后会显示内网IP地址,但在实际使用的时候需要用外网IP地址;

使用

一般使用

IP

和用户名密码即可使用
如果需要固定IP或IP段,可以修改配置文件设置白名单

vi /etc/danted/sockd.conf
修改以下代码,改成你需要设置的白名单IP或IP段即可,然后重启使其生效;

client pass {
        from: 0.0.0.0/0  to: 0.0.0.0/0
}

卸载

bash install.sh --uninstall

命令

命令或者说明service sockd start/etc/init.d/sockd start启动socks5服务器守护进程service sockd stop/etc/init.d/sockd stop停止socks5服务器守护进程service sockd restart/etc/init.d/sockd restart重新启动socks5服务器守护进程service sockd reload/etc/init.d/sockd reload重新加载socks5服务器守护进程service sockd status/系统进程状态service sockd state/etc/init.d/sockd state运行状态service sockd tail/etc/init.d/sockd tailsock 日志service sockd adduser/etc/init.d/sockd adduser添加pam-auth用户:service sockd adduser NAME PASSWORDservice sockd deluser/etc/init.d/sockd deluser删除pam-auth用户:service sockd deluser NAME
使用Proxifier工具代理

标签: ubuntu debian centos

本文转载自: https://blog.csdn.net/qq_15371293/article/details/130853660
版权归原作者 logiSim~ 所有, 如有侵权,请联系我们删除。

“Ubuntu/Debian/CentOS搭建Socks5代理一键脚本”的评论:

还没有评论