script to change root password

Hi All,

I'm looking for a script to change root password for about 200 servers of both Solaris and Linux. I'm not very good at scripting, can anyone share a script if you already have one?
:slight_smile:

just for an idea...

#!/usr/bin/expect -f
spawn telnet server1
expect "login:"
send "root\r"
expect "Password:"
send "secret\r"
expect "server1>$"
send "passwd\r"
expect "password:"
send "new\r"
expect "retype password:"
send "new\r"
expect eof

maybe nis or ldap is a better solution...

The above script didnot work, we use ssh and NIS+ is our environment.