How to add bulk users in UCS in an easy way


#1

Hi,

Is there a straight forward way to add bulk users into UCS?

There is no simple way and in the forum, there is always a mention of one or other method but not a simple way.

Any pointer to the correct URL would be appreciated


#2

Hey,

Univention comes with a command-line utility called “Univention Directory Manager”, its binary being udm. With it you can automate creation, deletion or modification of all objects in the LDAP server — including groups and users.

Normally I have a list of users and groups to create somewhere, e.g. in a CSV file. What I usually do is whip up a Perl script that reads such a file and creates the appropriate commands.

Here’s an example for creating a single user:

udm users/user create --ignore_exists \
  --superordinate cn=users,dc=internal,dc=mydomain,dc=de \
  --set overridePWHistory=1 \
  --set overridePWLength=1 \
  --set username=jdoe \
  --set uidNumber=12345 \
  --set firstname=Jane \
  --set lastname=Doe \
  --set unixhome=/home/jdoe \
  --set shell=/bin/bash \
  --set password=ThisIsTheNewPasswordInPlaintext \
  --set 'primaryGroup=cn=Domain Users,cn=groups,dc=internal,dc=mydomain,dc=de' \
  --set e-mail=jdoe@mydomain.de \
  --set PasswordRecoveryEmail=jdoe@mydomain.de

You can learn about the Univention Directory Manager in the admin docs.

Kind regards,
mosu