I need to set up a large number of local user accounts on a number of machines running Ubuntu, and I need a way to script the password setting. These machines use /etc/shadow, as is the default in the installation. passwd doesn't take a password as argument, and usermod wants the password in encrypted form.
The best way I have found is to write a separate C program to use crypt to encrypt the passwords, and then use usermod to set them in /etc/shadow.
But is there some other way I can script password setting like this, that at least doesn't require me to do parts of it in C? It seems to me there must be some command I don't know about?