Centos 7.8 安装 socks5 服务端

安装环境依赖

yum -y install  gcc openldap-devel pam-devel openssl-devel 

安装 SS5

wget --no-check-certificate  https://nchc.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
tar -xzvf ss5-3.8.9-8.tar.gz
cd ss5-3.8.9
./configure
make
make install

修改配置文件

cp /etc/opt/ss5/ss5.conf /etc/opt/ss5/ss5.conf.bak
vi /etc/opt/ss5/ss5.conf
#auth    0.0.0.0/0    -    -
修改为
auth    0.0.0.0/0    -    u

#permit -       0.0.0.0/0       -       0.0.0.0/0       -       -       -       -       -
修改为
permit u        0.0.0.0/0       -       0.0.0.0/0       -       -       -       -       -

注意是 – 改为 u
改完之后保存

添加账号

vi /etc/opt/ss5/ss5.passwd

一行一个用户名密码,中间用空格隔开

服务开机启动

chmod u+x /etc/rc.d/init.d/ss5
chmod +x /etc/init.d/ss5
chkconfig --add ss5
systemctl restart ss5    

启动ss5服务

systemctl start ss5
systemctl status ss5

file

测试服务

file

故障处理

重启后报错

ss5.service - SYSV: This script takes care of starting and stopping ss5
   Loaded: loaded (/etc/rc.d/init.d/ss5; bad; vendor preset: disabled)
Active: active (exited) since Thu 2023-07-27 22:52:35 CST; 4min 39s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3015 ExecStop=/etc/rc.d/init.d/ss5 stop (code=exited, status=0/SUCCESS)
  Process: 3028 ExecStart=/etc/rc.d/init.d/ss5 start (code=exited, status=0/SUCCESS)
Jul 27 22:52:35 ecs systemd[1]: Stopped SYSV: This script takes care of starting and stopping ss5.
Jul 27 22:52:35 ecs systemd[1]: Starting SYSV: This script takes care of starting and stopping ss5...
Jul 27 22:52:35 ecs ss5[3028]: /etc/rc.d/init.d/ss5: line 18: [: =: unary operator expected
Jul 27 22:52:35 ecs ss5[3028]: [29B blob data]
Jul 27 22:52:35 ecs systemd[1]: Started SYSV: This script takes care of starting and stopping ss5.
Jul 27 22:52:35 ecs ss5[3028]: Can't create pid file /var/run/ss5/ss5.pid
Jul 27 22:52:35 ecs ss5[3028]: Can't unlink pid file /var/run/ss5/ss5.pid

修改方法:在文件/etc/sysconfig/ss5修改参数,指定pid路径。

vi /etc/sysconfig/ss5

#追加内容
SS5_OPTS=" -p /var/run/ss5.pid"

重启服务后问题解决。

《Centos 7.8 安装 socks5 服务端》有2条评论

  1. 您好,指定pid路径以后,ss5可以正常运行,但是用ss5 -u userid -b 149.35.43.4 给用户配置出口ip的时候仍然提示 Can’t create pid file /var/run/ss5/ss5.pid
    Can’t unlink pid file /var/run/ss5/ss5.pid ,这个是有遇到吗

    回复

发表评论