Take the 2-minute tour ×

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

man newusers

read this and this

share|improve this answer
Ah, so there was a command for this that I didn't know about. Thanks! –  Thomas Padron-McCarthy Sep 27 '09 at 8:58

Your Answer


