Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Possible Duplicate:
Run adduser non-interactively

I've looked into adduser and can see there are some modification flags that I can configure, but this still processes a single user at a time. Is there a way to process a whole batch of users at one time? I'm thinking of reading in an CSV with username and password.

It looks like FreeBSD's adduser had a hook for processing non-interactively.

share|improve this question

marked as duplicate by Avery Chan, James Henstridge, jokerdino, belacqua, Marco Ceppi Aug 21 '12 at 18:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The only thing it doesn't cover is adding a password. So maybe it's not really a duplicate after all. – Avery Chan Jul 2 '12 at 9:54

Puppet. Just. Use. Puppet. Instructions on install puppet are available here, and you can also use puppet without a puppetmaster.

user { "dave":

  ensure  => present,
  uid  => '507',
  gid  => 'admin',
  shell  => '/bin/zsh',
  home  => '/home/dave',
  managehome => true,
  password => 'password',

Put something like that in your puppet manifest, and you're good to go. More details on page two of this PDF.

share|improve this answer

Step through the CSV in a loop, and run adduser once for each line.

share|improve this answer
OK, but how do I process the password automatically? – Avery Chan Jul 3 '12 at 3:25
You'll have to do that with 2 commands. 1) adduser, and 2) passwd. You can send piped input to the passwd command, like this: echo thePassword | passwd theUsername --stdin – Tom Jul 3 '12 at 12:32

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