新建只能访问LUCI的非root用户

编译LEDE/openWRT,不管是ssh远程登录还是luci界面都只有root用户,为了增强系统的安全性,就要将ssh和luci的用户做区分。

本例默认用户为root,密码为123456,作为系统访问用户;
新增用户为admin,密码为admin,作为luci登录用户;

添加admin用户

打开~/lede/package/base-files/files/etc/passwd文件,新增一行

admin: 1 <script type="math/tex" id="MathJax-Element-1">1</script>bMnX4.As$1zYpw0zNYtiDD/EI6TVGd1:1000:1000:::/bin/false

前两个冒号中间的字符串时加密后的admin密码,大家可以自行修改

修改LUCI登录用户

打开~/lede/feeds/luci/modules/luci-mod-admin-full/luasrc/controller/admin/index.lua文件,如下修改:

diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/index.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/index.lua
old mode 100644
new mode 100755
index cc8c2e3..1efbc49
--- a/modules/luci-mod-admin-full/luasrc/controller/admin/index.lua
+++ b/modules/luci-mod-admin-full/luasrc/controller/admin/index.lua
@@ -14,7 +14,7 @@ function index()
        page.target  = firstchild()
        page.title   = _("Administration")
        page.order   = 10
-       page.sysauth = "root"
+       page.sysauth = "admin"
        page.sysauth_authenticator = "htmlauth"
        page.ucidata = true
        page.index = true

正常编译 make V=s

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值