轉載請注明來源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。