Last active
September 21, 2017 09:01
-
-
Save angelmmg90/75f8c41863363c5f3bcf4b1f1cc5af3c to your computer and use it in GitHub Desktop.
To bulk add users in LDAP to simulate a production environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USERNAME="dummyuserldap" | |
DIRSRV="127.0.0.1" | |
PORT="10389" | |
ROOTDN="uid=admin,ou=system" | |
PASSWD="secret" | |
LDIF="/home/vagrant/ldif-gen/bulkuser.ldif" | |
for i in $(seq 20000 40000); do | |
echo "dn: uid=$USERNAME$i,ou=users,dc=example,dc=com" > $LDIF | |
echo "cn: Bulk User$i" >> $LDIF | |
echo "uid: $USERNAME$i" >> $LDIF | |
echo "objectClass: top" >> $LDIF | |
echo "objectClass: person" >> $LDIF | |
echo "objectClass: inetOrgPerson" >> $LDIF | |
echo "objectClass: organizationalPerson" >> $LDIF | |
echo "sn: $USERNAME$i" >> $LDIF | |
echo "userPassword: $PASSWD$i" >> $LDIF | |
echo -e "\n" >> $LDIF | |
/usr/bin/ldapmodify -x -h $DIRSRV -p $PORT -D "$ROOTDN" -w $PASSWD -a -f $LDIF | |
done | |
#EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment