You might consider using ldap or nis+. I don't have the experience on installing or using them to give you a how-to however.
Another option is using 'cfengine'. This is often used to distribute changes to many machines.
Another option is to use ssh to securely send the password to the other machines.
About setting the password prompt to $pword, I think using a here document might work.
passwd $uname <<+
Some references to look at:
For using NIS
Explaining HERE documents:
There are probably how-to's in the tldp.org website.