How-To: Deactivate user if I have exceeded the license

How to deactivate user if I have exceeded the license

Environment

  1. licensed UCS environment
  2. You need to deactivate a bulk of users

Single user you can deactivate with:

root@ucs:~# udm users/user modify --dn uid=MyUsername,cn=users,$(ucr get ldap/base) --set disabled=1

Note1: The UDM users module is not usable as far as bug 46289 is not fixed. Here is a workaround.

Disable a bulk of users

Step 1: Create a report CSV to filter the users

univention-directory-reports -m users/user -r "CSV Report" $(udm users/user list --position cn=users,${ldap_base} | sed -ne 's/^DN: \(.*\)$/\1/p')

Step 2: Filter the users

you can copy the report file with scp to your computer and filter the csv in a Spreadsheet of your choice.

scp root@<IP or FQDN of your system>:/tmp/univention-directory-reports-54X3zj.csv ./

We need a list with the usernames of the users you want to deactivate for the next step.

Step 3: Deactivate the users

We need the list on the master. An easy way is to copy the column with the filtered usernames and paste them into a new textfile on the server.

cat UserList.txt |while read name; do udm users/user modify --dn uid=$name,cn=users,$(ucr get ldap/base) --set disabled=1; done

Note! You may change the dn f.e. for an OU if the users are placed in an OU as they are in a school environment.

Mastodon