I'm using busybox with a limited passwd (I don't have --stdin option) and without chpasswd
and I need to change the password of an user from bash. Here is my best result:
echo newpassword > pwdfile
echo newpassword > pwdfile
cat pwdfile | passwd myuser
Changing password for myuser
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
Enter new password:
Bad password: too simple.
Warning: weak password (continuing).
Re-enter new password:
passwd: The password for myuser is unchanged.
< pwdfile chpasswd
. – Chris Down Dec 13 '11 at 15:04passwd --version
? – nopcorn Dec 13 '11 at 15:21Usage: passwd [OPTION] [name]
Change a user password. If no name is specified, changes the password for the current user. Options: -a Define which algorithm shall be used for the password (Choices: des, md5) -d Delete the password for the specified user account -l Locks (disables) the specified user account -u Unlocks (re-enables) the specified user account
– michelemarcon Dec 14 '11 at 08:03/etc/passwd
and/etc/shadow
? – nopcorn Dec 14 '11 at 15:01