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.

  • 1
    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.


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

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