Situatie
chpasswd command is used to change password although passwd command can also do same. But it changes the password of one user at a time so for multiple users chpasswd is used. Below figure shows the use of passwd command. Using passwd we are changing the password of the guest user. Here first you have to enter the password of the currently signed user and then you change the password of any other user. One must have administrator privileges.
Solutie
Pasi de urmat
chpasswd command reads a number of username and password which are separated by colon using standard input or file, and then encrypt as per the options.
$chpasswd user1:user1_password user2:user2_password user3:user3_password
Note: After completion please press ctrl+d to exit from the command. As soon as ctrl + d is pressed password gets changed.
A simple text file can also be used to store username and password and then use them to change the password.
$cat > pass.txt user1:user1_password user2:user2_password user3:user3_password
Then provide this to chpasswd command.
$chpasswd < file_name.txt
Leave A Comment?