寻思给 uhttpd 做个验证更安全。于是查了一下 Openwrt 的 Wiki(http://wiki.openwrt.org/doc/uci/uhttpd),测试成功。

 

首先打开 uhttpd 的配置文件 vi /etc/config/uhttpd
然后找到这两行:
# Basic auth realm, defaults to local hostname
#?? ?option realm?? ?OpenWrt

# Configuration file in busybox httpd format
#?? ?option config?? ?/etc/httpd.conf

去掉这两个行的#注释,realm是在浏览器中验证提示时的主机名:

uhttpd

 

然后在/etc 下面,新建一个 httpd.conf,内容写:
/:root:$p$root

 

如果需要的话,还可以把 luci 访问时的跳转 index.html 默认的几个字改一下:
echo "<P>Login</P>" > $(uci get uhttpd.main.home)/index.html

 

最后重启 uhttpd 即可生效。
/etc/init.d/uhttpd restart

 

访问一下看看:

auth_login_pop