Luci新增Web admin用户
OpenWrt 系统默认使用root用户登陆Luci,但是这样存在潜在风险。
新增web用户可以参考如下流程,第五点是关键
1.vim /etc/passwd
admin:x:0:0:root:/var:/bin/false //这样就不能ssh登入了
2.vim /etc/shadow
admin::0:0:99999:7::: //默认无密码
admin:uL5mRlqPSUNNI:17680:0:99999:7::: //默认密码admin
3.vim ./lua/luci/controller/admin/index.lua
page.sysauth = “admin”
4.vim ./lua/luci/controller/admin/servicectl.lua
entry({“servicectl”}, alias(“servicectl”, “status”)).sysauth = “admin”
5.修改/etc/config/rpcd 中的权限改为admin,否则admin账号ubus拒绝登陆
config login
option username ‘admin’
option password ‘$p$admin’
list read ‘*’
list write ‘
6.vim usr/lib/lua/luci/view/themes/bootstrap/header.htm //提示语言修改
<%- if luci.sys.process.info(“uid”) == 0 and luci.sys.user.getuser(“admin”) and not luci.sys.user.getpasswd(“admin”) then -%>
<%:There is no password set on this router. Please configure a admin password to protect the web interface and enable SSH.%><br>