很多人问我ShadowsocksR怎么添加多用户,怎么更改密码,启动命令是什么等等。我将会在这篇文章分享出修改这些设置的教程。
实战vultr搭建SSR+锐速(一键傻瓜式搭建):https://www.svlik.com/?p=161
ShadowsocksR基本命令
1 2 3 4 5 6 7 |
<span class="pun">启动:/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">shadowsocks start </span><span class="pun">停止:/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">shadowsocks stop </span><span class="pun">重启:/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">shadowsocks restart </span><span class="pun">状态:/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">shadowsocks status </span><span class="pun">配置文件路径:/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">shadowsocks</span><span class="pun">.</span><span class="pln">json </span><span class="pun">日志文件路径:/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">log</span><span class="pun">/</span><span class="pln">shadowsocks</span><span class="pun">.</span><span class="pln">log </span><span class="pun">安装路径:/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">shadowsocks</span><span class="pun">/</span><span class="pln">shadowsoks</span> |
SSR更改密码教程
- 执行脚本vi /etc/shadowsocks.json,进入vi编辑器,编辑配置文件
- 按i(英文状态下的i)进入编辑状态,用方向键将指针调到相应位置删除旧密码,改成新密码。
- 编辑完成后,依次按esc : wq 回车。(执行完后文件就已经保存,并退出到命令页面了)
- 最后重启ssr即可/etc/init.d/shadowsocks restart
至此密码修改完毕,如果觉得麻烦,请继续往下看。
使用xFtp给SSR添加多用户教程
使用xftp工具(下载地址:https://www.svlik.com/263.html)连接再编辑,方便不会使用命令的新手
完整的多用户配置(/etc/shadowsocks.json)如下:
保存以下代码并命名为:shadowsocks.json
以下代码中,端口1和密码1 表示第一个用户的端口和密码,以此类推。修改成你想要的密码和端口,多余的可以删除,不够可以添加。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<span class="pun">{</span> <span class="str">"server"</span><span class="pun">:</span> <span class="str">"0.0.0.0"</span><span class="pun">,</span> <span class="str">"server_ipv6"</span><span class="pun">:</span> <span class="str">"::"</span><span class="pun">,</span> <span class="str">"local_address"</span><span class="pun">:</span> <span class="str">"127.0.0.1"</span><span class="pun">,</span> <span class="str">"local_port"</span><span class="pun">:</span> <span class="lit">1081</span><span class="pun">,</span> <span class="str">"port_password"</span><span class="pun">:{</span> <span class="str">"端口1"</span><span class="pun">:</span><span class="str">"密码1"</span><span class="pun">,</span> <span class="str">"端口2"</span><span class="pun">:</span><span class="str">"密码2"</span><span class="pun">,</span> <span class="str">"端口3"</span><span class="pun">:</span><span class="str">"密码3"</span><span class="pun">,</span> <span class="str">"端口4"</span><span class="pun">:</span><span class="str">"密码4"</span><span class="pun">,</span> <span class="str">"端口5"</span><span class="pun">:</span><span class="str">"密码5"</span><span class="pun">},</span> <span class="str">"timeout"</span><span class="pun">:</span> <span class="lit">120</span><span class="pun">,</span> <span class="str">"udp_timeout"</span><span class="pun">:</span> <span class="lit">60</span><span class="pun">,</span> <span class="str">"method"</span><span class="pun">:</span> <span class="str">"chacha20"</span><span class="pun">,</span> <span class="str">"protocol"</span><span class="pun">:</span> <span class="str">"auth_sha1_v4_compatible"</span><span class="pun">,</span> <span class="str">"protocol_param"</span><span class="pun">:</span> <span class="str">""</span><span class="pun">,</span> <span class="str">"obfs"</span><span class="pun">:</span> <span class="str">"tls1.2_ticket_auth_compatible"</span><span class="pun">,</span> <span class="str">"obfs_param"</span><span class="pun">:</span> <span class="str">""</span><span class="pun">,</span> <span class="str">"dns_ipv6"</span><span class="pun">:</span> <span class="kwd">false</span><span class="pun">,</span> <span class="str">"connect_verbose_info"</span><span class="pun">:</span> <span class="lit">1</span><span class="pun">,</span> <span class="str">"redirect"</span><span class="pun">:</span> <span class="str">""</span><span class="pun">,</span> <span class="str">"fast_open"</span><span class="pun">:</span> <span class="kwd">false</span><span class="pun">,</span> <span class="str">"workers"</span><span class="pun">:</span> <span class="lit">1</span> <span class="pun">}</span> |
至此配置文件已经修改完毕,现在需要执行命令来激活设置的端口。
开端口命令:
1 |
<span class="pln">iptables </span><span class="pun">-</span><span class="pln">I INPUT </span><span class="pun">-</span><span class="pln">p tcp </span><span class="pun">--</span><span class="pln">dport </span><span class="pun">端口</span> <span class="pun">-</span><span class="pln">j ACCEPT</span> |
例如我设置了9999端口,则需要输入命令:
1 |
<span class="pln">iptables </span><span class="pun">-</span><span class="pln">I INPUT </span><span class="pun">-</span><span class="pln">p tcp </span><span class="pun">--</span><span class="pln">dport </span><span class="lit">9999</span> <span class="pun">-</span><span class="pln">j ACCEPT</span> |
如果开启了多个端口,则需要执行多次。
当所有的端口命令执行完毕之后重启SSR即可。
重启SSR命令:
1 |
<span class="str">/etc/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">shadowsocks restart</span> |