0

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.

2 Answers2

1

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.

jrg
  • 60,611
0

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

Tom
  • 750
  • OK, but how do I process the password automatically? – Son of the Wai-Pan Jul 03 '12 at 03: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 03 '12 at 12:32