Openwrt 网页多用户访问


一、添加用户访问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>

本文章由作者:佐须之男 整理编辑,原文地址: Openwrt 网页多用户访问
本站的文章和资源来自互联网或者站长的原创,按照 CC BY -NC -SA 3.0 CN协议发布和共享,转载或引用本站文章应遵循相同协议。如果有侵犯版权的资 源请尽快联系站长,我们会在24h内删除有争议的资源。欢迎大家多多交流,期待共同学习进步。

相关推荐