# Sharing can't find some contacts

**URL:** <https://help.nextcloud.com/t/sharing-cant-find-some-contacts/27133>\
**Category:** ℹ️ Support\
**Tags:** nc13\
**Created:** [February 8, 2018, 6:39pm UTC](https://help.nextcloud.com/t/sharing-cant-find-some-contacts/27133 "2018-02-08T18:39:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nicktheitguy](https://help.nextcloud.com/letter_avatar/nicktheitguy/32/5_5575768a8748004e209b776fc1b2916d.png) [@nicktheitguy](https://help.nextcloud.com/u/nicktheitguy)\
**Post date:** [February 23, 2018, 12:02am UTC](https://help.nextcloud.com/t/sharing-cant-find-some-contacts/27133/2 "2018-02-23T00:02:41Z")

</div>

Well, I have solved my own issues. It appears that at some point the user database got duplicates in it, causing this issue. The steps I took to find/solve the issue:  
Show remnants of LDAP users that were deleted:

```
sudo -u www-data php occ ldap:show-remnants

```

What I saw was a bunch of users that had two usernames. For example, JSmith and JSmith\_1234 where the 1234 was a random number. I have seen this in other posts, such as:

> [@Migration to LDAP keeping users and data](https://help.nextcloud.com/t/migration-to-ldap-keeping-users-and-data/13205/9):
>
> I have just done the procedure, and it went quite fine, except for the fact that I had active sync clients running, which gotten me into trouble. When I enabled LDAP, but not yet deleted the users yet, a desktop client went and tried to log in. Result was two accounts, one as the original and the LDAP username was appended with an underscore and four digits. Removing the local accounts and again deleting LDAP relations, ultimately got it working again, thou I got a bit scared, when I logged as…

I think something either happened because I had two LDAP servers set up to the same directory or at some point the guy that was the Nextcloud admin before me had started to pull in the whole directory. Also, rather than using the displayName as the UID, I thought it might be better to use the mailNickname. Since I only had 50 users in the system and no real data to speak of, I decided to remove the users, make the changes, remove all the remnants and re-add the users (and data for those that had it).  
Change the internal Username Attribute to mailNickname under Expert in LDAP/AD Integration.  
Remove a user or group of users from the AD group(s)  
Facilitate the changes in Nextcloud by clicking on ‘Verify settings and count users’, then ‘Verify settings and count the groups’, and finally [https://nextcloud.mydomain.com/cron.php](https://nextcloud.mydomain.com/cron.php) to force the cron.  
Re-run the show-remnants command from above until the user was listed as deleted.  
Copy the user data to a temp location in the server and remove the remnants:

```
cp -rf /var/ncdata/JSmith /var/ncdata/John
sudo -u www-data php occ user:delete JSmith

```

Add the user to the group(s) in AD, facilitate the changes again.  
Have the user login and log out of Nextcloud…this creates their profile directory again.  
Copy the user data back in to their directory. The first time, it “didn’t work”, meaning that they could not see their data. This can be achieved by adding a line to your config.php, which I found here:

> [@Files copied via System to users file path are not shown](https://help.nextcloud.com/t/files-copied-via-system-to-users-file-path-are-not-shown/5767/3):
>
> thx. I have found a Parameter for the config.php “filesystem\_check\_changes” and set this to 1. Now i could see the changes. My Problem with the External Storage App is, that, if i enable the App, i cant use the “Stay logged in” Feature. Or is there a way to use it also in case of the External Storage App?

Data was back, and the user just had to re-share it. Another way to accomplish the data backup and restore was to have the user load the client, sync their data, then go through the deletion process and use the client to push the data back up.  
After removing all users from the system, and all the remnants from the extra users (underscore plus four numbers users), and making the UID change, my sharing works the way it did before I started having problems. I also added the second LDAP server as a “Backup (Replica) Host” under LDAP/AD Integration \> Advanced \> Connection Settings, instead of as a second LDAP server.

---

_[View the full topic](https://help.nextcloud.com/t/sharing-cant-find-some-contacts/27133)._
