[Freeipa-users] [HOWTO] Bulk creating test users

Simo Sorce ssorce at redhat.com
Wed Sep 26 17:17:40 UTC 2012


Hello list,

I wanted to share a simple way I use to create users for testing, it is something that I get regularly asked when we do testing so I thought it may turn useful to others.

Assume we have a FreeIPA domain called freeipa.org and we want to create a few test users with a specific password,
here is a simple script that does it (requires you kinit as admin first):

---------------------------------------------------------------------------------
#!/bin/bash

# Pass user name as first argument and password as second argument

ipa user-add $1 --first Test --last User
echo "test" | ipa passwd $1 
ldappasswd -D uid=$1,cn=users,cn=accounts,dc=example,dc=org -w test -a test -s $2
---------------------------------------------------------------------------------


In this example no escaping is performed, so you'll need to add it to user names/password if you want to use characters that may cause shell expansion.

Hope this helps.

Simo.

-- 
Simo Sorce * Red Hat, Inc. * New York




More information about the Freeipa-users mailing list