Ubuntu不能使用passwd的--stdin的解决办法

转载请注明来源https://www.cnblogs.com/sogeisetsu/p/11397648.html

Ubuntu不能使用passwd的--stdin的解决办法

可以使用chpasswd
看一下man chpasswd

DESCRIPTION
       The chpasswd command reads a list of user name and password pairs from standard input and uses this information to update a group of
       existing users. Each line is of the format:

       user_name:password

所以可以echo username:newoasswd | chpasswd
username是用户名,newpasswd是新密码。值得注意的是echo后面不要忘了加引号把用户名和新密码引起来
最后说一个事情,目前发现Ubuntu的16.1系统没有--stdin和/etc/rc.local,所以建议大家初学Linux不要用Ubuntu。

posted @ 2019-08-23 00:50  sogeisetsu  阅读(4062)  评论(0编辑  收藏  举报