There are a number of cluster commands that allow performing operations on all cluster nodes at once, e.g. cexec, as in cexec mkdir /scratch/something.

How can I change the password on all nodes at once for a user?

  • That's a good reason why admins use LDAP or Kerberos. – Jeight Feb 25 '16 at 18:06

This should work:

for i in serverlist;do
   ssh $i "usermod --password $(echo my_new_password | openssl passwd -1 -stdin) USERNAME"

usermod doesn't prompt but the password needs to be encrypted first.

  • Seems to work as root. If I try it as regular user, I get in trouble with permissions. – Magicsowon Feb 26 '16 at 10: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.