LDAP User Cleanup doesn't work


My setup is Nextcloud 12.0.0 with LDAP authentication. By default Nextcloud uses an UUID as username for LDAP users, but i changed that going in the LDAP configuration to Expert tab and setting Internal Username Attribute to use the real username and pressed the Clear Username-LDAP User Mapping which created new users in the DB without deleting the old ones. Because of this users appear twice in the contact list.

I found out about LDAP User Cleanup, but it didn’t mark any user for deletion, i even set the cleanup interval to 5 minutes, but nothing. When i enter the command “sudo -u www-data php occ ldap:show-remnants” the table is empty and if i try “sudo -u www-data php occ user:delete username” for a user that LDAP User Cleanup should mark for deletion it says the user doesn’t exists, even if it appears in the DB.

How can i make LDAP User Cleanup work or delete the unwanted users?

With pressing Clear Username-LDAP User Mapping all old mappings are gone and as such old users are not recognized as LDAP users anymore.

What you can do as workaround: get the old userids, create a local user, and delete it again. This should clean up all remaining data. Be careful if you configured User Home Folder Naming Rule to match the data folder for new users with the old userid – it would get deleted.

Thanks for the idea, i will test this. But this would be ok when dealing with just a few users, but not so nice when more than 50 users. Is there really no quicker/easier way?

Did a test and i am able to remove the entry from DB that should have been deleted. And i guess i could make a script to deal with multiple users.
But the user i tested this with is still duplicated in the contact list.

Of coursescripting it does the trick.

I’d refrain from deleting stuff in the DB manually…

Not manual delete from DB, I expressed wrongly, sorry. But with your workaround by creating a local user with old UUID and then deleting it.

Using your method solves almost everything, but as i said before in contacts list the username still appears twice.

Here is exactly what i mean