Wednesday, 23 November 2011

newbie linux and shell scripts/need to change root password on 12 srv

newbie linux and shell scripts/need to change root password on 12 srv

i need to change the root password on 12 servers. I know this is a small amount and I would have already finished changing the passwords manually in the time I have spent searching the forums for the answer. But that is no way to learn. Here is my script but I am still being prompted for the root password. And when I do enter the root password at the prompt, the new password doesn't seem to take. Here is my shell script;

#!/bin/bash
for x in server1 server2 server3
do
echo $x is being fixed
ssh $x echo "newpassword" | passwd root --stdin
done

*The results is

root-server]#./aala.sh
server1 is being fixed
Changing password for user root.
root-server1's password:

**I am running RHEL 5.6

No comments:

Post a Comment