LDAP Creates duplicate accounts with random number in NC


We have configured LDAP, issue is that when nextcloud have same username as ldap have, another username mapped in user list with same name along with random number. For example user01 is local NC account, LDAP also have user01, then within 10 mins ldap maps it as user01_123.

How to stop this and clear all these mapping? I tried to clear mapping in Advance tab of LDAP app of nextcloud, then it clears and then appeared again with new number

NC: 25.0.3
OS: Debian 11

Please advice

What is it that you want to achieve?

You cannot map the LDAP to existing local users, so LDAP users will always be mapped to new users.

If the userid is already in use LDAP backend will assign a new one using the prefix system that you saw.


We need to migrate local user to LDAP. That is achieved already in test environment. But now issue is that we have created all users in ldap first that mapped with system prefix (offcourse ldap usernames are same as local user).

So i used clear mapping, and migrated two or 3 users but users mapped again, then really i don’t clear mapping because some live users already migrated.

My question is not related migration, my question is,can someone advice how to stop these user enteries with prefix?

Users are mapped when logging in, when searched for, and with a background job I think.
So maybe if you disable cron and do not search for users while your are doing your migrations the mapping will not happen.

An other solution is to add a flag in your LDAP for users which are not ready to be mapped, and you filter them out with the LDAP filter. Then when you want them to get mapped you switch the flag.

Thank you, can you please advice how to stop that cronjob

In your cron configuration, see https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html