一、添加用户访问web
1、vim ./lua/luci/controller/admin/index.lua
page.sysauth = {"root","win"}
2、vim ./lua/luci/controller/admin/servicectl.lua
entry({"servicectl"}, alias("servicectl", "status")).sysauth = {"root","win"}
二、修改默认用户为admin
1、vim /etc/passwd
admin:x:0:0:root:/var:/bin/false //这样就不能ssh登入了
2、vim /etc/shadow
admin::0:0:99999:7::: //默认无密码
admin:$1$IUy8Oqop$u9kDk9L5JyvKaa2UCZUCR.:16595:0:99999:7::: //默认密码admin
3、vim ./usr/lib/lua/luci/dispatcher.lua
if not user or not util.contains(accs, user) then
if (not user) then return end -- send non 'admin' system user back to a login page with a user/passwd error
require("luci.i18n")
require("luci.template")
context.path = {}
luci.template.render("sysauth", {duser=default, fuser=user})
return
4、vim ./lua/luci/controller/admin/index.lua
page.sysauth = "admin"
5、vim ./lua/luci/controller/admin/servicectl.lua
entry({"servicectl"}, alias("servicectl", "status")).sysauth = luci.dispatcher.context.authuser
6、 edit /usr/lib/lua/luci/controller/admin/system.lua and change line 326 to read
stat = luci.sys.user.setpasswd("admin", p1)
this is important or luci will change the root password instead of the admin password under system->administration
7、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>