Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.