
在学习本文前请确认你的搬瓦工服务器已经安装好Shadowsocks服务, 在此基础上才能配置多用户账户使用, 多端口使用! 本文主要讲解shadowsocks简称ss设置多端口多密码方式,以搬瓦工VPS为例,演示系统环境为CentOS6.8。 想必大家用过搬瓦工VPS的都知道, 搬瓦工的VPS服务自带有一键设置ss功能非常方便, 一键设置的过程我就不说了, 网上教程非常多, 而且也太简单了。但是我们如果只通过一键的SS设置, 你只能得到一个端口和密码,当然这个端口和密码你也可以共享给你的朋友, 但是使用起来使用不是很方便小编在网上也搜索了各种方法, 但是都是手动来配置ss多端口多密码的, 如果你想要通过那些文章配置成功个人感觉还是非常难的, 特别是对于linux比较陌生的同学, 还需要你综合多篇文章来看, 因为很多都是别人直接复制粘贴, 有的就写的一半, 可能粘贴的都不完整比较坑, 还有些标点符号大小写错误等等, 都会导致你复制其他人文章里的操作代码的时候,总会出现报错的问题,所以小编写了这篇文章, 为大家提供一个简单快速的手动搭建SS的的方法。
如果你没有搬瓦工VPS: https://bwh8.net
[申明和建议:严禁利用VPS、服务器用于违规用途
]
搬瓦工VPS多端口多用户密码手动配置教程
我们首先使用终端连接client软件连上搬瓦工服务器(推荐使用FinalShell工具, 国人自己研发的SSH工具)

连接到搬瓦工VPS服务器

VPS服务器命令行:
首先我们以root用户运行以下命令(注意字符大小写)
yum -y install wget
wget --no-check-certificate http://blog.whsir.com/uploads/ss.sh
chmod +x ss.sh
./ss.sh 2>&1 | tee shadowsocks.log
如果提示你的linux服务器没有安装yum命令, 百度搜索安装即可!
执行命令后会提示下面内容,直接回车即可(如果没反应就再敲下回车),然后就开始等待就行。
#############################################################
# One click Install Shadowsocks(Python)
# Intro: http://blog.whsir.com
#
# Author: whsir
#
#############################################################
Please input password for shadowsocks:
(Default password: whsir):
安装完成后显示内容如下:
Congratulations, ss install completed!
Your Server IP:your_server_ip
Your Server Port:443
Your Password:your_password
Your Local IP:127.0.0.1
Your Local Port:1080
Your Encryption Method:aes-256-cfb
Welcome to visit:blog.whsir.com
Enjoy it!
安装成功我们会看到如上的显示!
搬瓦工VPS中SS卸载命令:
./ss.sh uninstall
搬瓦工VPS中SS多端口多密码配置:
#vi /etc/shadowsocks.json
这时我们按i,进入编辑文本模式, 粘贴以下配置(原有内容需要删除)
搬瓦工VPS中SS多端口多密码配置:
{
'server': 'xxx.xxx.xxx.xxx',
'server_port': 8381, #端口任意(前提不占用已用端口)
'local_address': '127.0.0.1',
'local_port': 1080,
"port_password":{
"7788":"password0",
"7789":"password1",
"7790":"password2"
},
'password': 'xxxxxx', #密码
'timeout': 300,
'method': 'aes-256-cfb',
'fast_open': false
}
server | 服务器地址,填ip或域名 |
local_address | 本机地址 |
local_port | 本地端口,可任意 |
server_port | 服务器对外开的端口 |
password | 密码,可以每个服务器端口设置不同密码 |
port_password | server_port + password ,服务器端口加密码的组合 |
timeout | 超时重连时间, 单位毫秒 |
method | 默认: “aes-256-cfb”(一种加密方式) |
fast_open | 开启或关闭 TCP_FASTOPEN, 填true或false,需要服务端支持 |
注意: 7788、7789、7790为你要设置的端口号,后面是每个端口号对应的密码,设置端口号的时候切记不要存在端口冲突及占用的情况, 同时记得安全组及防火墙打开你要使用的端口。如果你要添加端口和密码,格式记得要和给出的示例保持一致,最后一个端口和密码后面没有逗号!
最后我们得重启下shadowsocks服务
未关闭防火墙会执行报错: 关闭防火墙service iptables stop
启动命令:service shadowsocks start
停止命令:service shadowsocks stop
重启命令:service shadowsocks restart
状态查询命令:service shadowsocks status
重启(修改配置要重启才生效):ssserver -c /etc/shadowsocks.json -d restart
搬瓦工VPS中SS开启启动设置
1.切换到root用户su root
2.在终端输入vi /etc/rc.local,
3.把里面最后的带有ssserver的一大段默认的代码删除掉,
4.再把ssserver -c /etc/shadowsocks.json -d start加进去,
5.按wq保存退出即可
搬瓦工VPS中配置SS报错解决(CentOS6.8)
使用过程中报错内容如下: Installed /usr/lib/python2.6/site-packages/setuptools-33.1.1-py2.6.egg Processing dependencies for setuptools==33.1.1 Finished processing dependencies for setuptools==33.1.1 Searching for pip Reading http://pypi.python.org/simple/pip/ Couldn't find index page for 'pip' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading http://pypi.python.org/simple/ No local packages or download links found for pip error: Could not find suitable distribution for Requirement.parse('pip') pip install failed! Please visit blog.whsir.com and cont 异常解决办法: 在命令行执行以下命令
yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/p/python-pip-7.1.0-1.el6.noarch.rpm
执行完成后在再命令行执行以下命令即可
./ss.sh 2>&1 | tee shadowsocks.log