Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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, belacq, 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.

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

2 Answers 2

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.