scripting password changes over ssh

Lots of examples on the net for scripting password changes using sed and perl and all kinds of other crap, easier is to use chpasswd:

bash# for host in host1 host2 host3; do ssh $host ‘echo root:newpassword | chpasswd’ ; done

newpassword is in cleartext. looks like there’s an option on chpasswd to use DES or something instead, I just needed to set these all quickly and move along. you’ll have to deal with ssh authentication yourself like either typing in the password or keys or whatever.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.