10

I want change 120 user's password. so I wrote sudo echo 'user:passwd' | chpasswd

but I had a message,

chpasswd: (user) pam_chauthtok() failed, error:
Authentication token manipulation error
chpaswd (line 1, user) password not changed

and also I tried another way using textfile, but I had same the message.

I can't solve this problem.

21

The usual way to change the password is to use the passwd(1) command.

If you want to use chpasswd(8) or usermod(8) you should carefully RTFM.

Be sure that the given password is compatible with the system configuration. And sudo should apply to the chpasswd command, so you probably want

echo 'user:passwd' | sudo chpasswd

In your case, sudo echo 'user:passwd' | chpasswd, the sudo is applied only to echo, which is incorrect.

| improve this answer | |
  • 1
    would even make more sense to run the whole thing as root instead of issuing sudo all the time. – Fiximan Aug 18 '15 at 13:40
  • @Fiximan: this really depends upon the system configuration. On some systems using sudo would be very sensible. – Basile Starynkevitch Aug 18 '15 at 13:41
  • 1
    Off: Using sudo bash once might be even more sensible. – Lorinczy Zsigmond Dec 13 '18 at 4:27
  • Or sudo -s .... – Basile Starynkevitch Jul 9 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.