在Openwrt系统中,用户可以通过一系列的SSH命令来实现当浏览器输入192.168.1.1后自动跳转到状态页的功能,从而避免每次访问时输入密码的麻烦。以下是具体的操作步骤和命令:
实现自动跳转至状态页的SSH命令
备份相关文件:
cp /etc/config/uhttpd /etc/config/uhttpd.back666 cp /www/index.html /www/index.html.back666 cp /usr/lib/lua/luci/dispatcher.lua /usr/lib/lua/luci/dispatcher.lua.back666
修改uhttpd配置文件:
sed -i "s,list index_page 'cgi-bin/luci',list index_page 'index.html'," /etc/config/uhttpd
修改index.html文件:
sed -i 's,meta http-equiv="refresh" content="0; URL=/cgi-bin/luci,meta http-equiv="refresh" content="0; URL=/cgi-bin/luci/admin,' /www/index.html
延长session时长:
sed -i 's/timeout=tonumber(luci.config.sauth.sessiontime)/timeout=99999999/' /usr/lib/lua/luci/dispatcher.lua
清除缓存并重启服务:
rm -rf /tmp/luci-modulecache/; rm /tmp/luci-indexcache; service uhttpd restart
如遇问题进行恢复
如果需要恢复到修改前的状态,可以使用以下命令:
恢复备份文件:
cp /etc/config/uhttpd.back666 /etc/config/uhttpd cp /www/index.html.back666 /www/index.html cp /usr/lib/lua/luci/dispatcher.lua.back666 /usr/lib/lua/luci/dispatcher.lua
清除缓存并重启服务:
rm -rf /tmp/luci-modulecache/; rm /tmp/luci-indexcache; service uhttpd restart
延长Cookie有效期
为了实现长期自动登录,可以安装edit this cookie扩展插件,并在登录Luci Web管理界面后修改cookies,去掉session属性。
通过以上步骤,用户可以轻松实现浏览器访问192.168.1.1后自动跳转到状态页,无需每次输入密码,提升了操作的便捷性。
评论已关闭