如何使用命令或python在OpenWrt中添加用户?

How to add an user in OpenWrt using command or python?

按照这个link https://vladimir-ivanov.net/create-user-without-useradd-command-openwrt/我做了所有的步骤,但是我没有在OpenWrt中添加任何用户 /etc/passwd 文件包含加密密码,应该在 /etc/shadow 中。我编辑并将用户添加到 /etc/passwd,然后我使用了 "passwd testuser" 命令。它要求我设置两次密码并将加密后的密码添加到 /etc/passwd。但它没有添加用户或向 /etc/shadow 写入任何内容。我在 Ubuntu 中做了同样的事情,并且成功了。但是我需要在OpenWrt中做。

您应该安装 shadow-useradd 软件包:

opkg update
opkg install shadow-useradd

文档:Secure your router's access