linux bash shell : how to create user with username and password from file?

标签 linux bash shell

除了如何使用脚本设置密码外,我什么都清楚。通常,我会写:

passwd username

终端会提示输入密码。如何从文件中读取密码?

最佳答案

您可以使用:

passwd --stdin username < filename

来自 passwd(1) :

--stdin This option is used to indicate that passwd should read the new password from standard input, which can be a pipe.

关于linux bash shell : how to create user with username and password from file?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4232024/

相关文章:

unix - 是否有 Unix 实用程序可以将时间戳添加到标准输入?

c++ - 创建共享库时发生核心转储

linux - Docker安装

ruby-on-rails - ruby on rails 未定义方法 `_delete' 在 rails 版本 2.3.15 中与 2.3.5 一起工作正常

bash - 如何在 Bash 中将变量设置为命令的输出?

linux - 如何获取top命令的输出

linux - UNIX Case 语句中的模式匹配

linux - 没有变量的 Bash 字符串操作

c - 使用 glfw 和 vsync 时桌面感觉迟钝

linux - 查看重定向到 dev/null 的进程的输出 - 撤消重定向