Change user passwords using shell script

Hi,

I want to change the password of unix users on a number of servers.My plan was to ssh to all the servers in a shell script and use the passwd command. I tried to do so but everytime i run it i get this error.

ssh -x -n -l user1 host passwd
Changing password for "user1"
3004-709 Error changing password for "user1".

I have gone through a number of posts but dint see anyone else having this issue.
Also, I dont mind entering the password on prompts , i dont want to install expect.Please let me know if I am doing something wrong.

Have you searched here?

Google Search Results for change password servers ssh | The UNIX and Linux Forums

Yes i have been through these posts already.
I have also tried to do:
ssh -T hostname "passwd user"
but that doesn't solve the problem either.

Here is one way to do it Solaris passwd script

You can also use the --stdin flag on Linux.