# LDAP users lost

**URL:** <https://forum.gitea.com/t/ldap-users-lost/5219>\
**Category:** Install/Maintain/Configure\
**Created:** [May 15, 2022, 1:48pm UTC](https://forum.gitea.com/t/ldap-users-lost/5219 "2022-05-15T13:48:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![blaizard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/blaizard/32/2664_2.png) [@blaizard](https://forum.gitea.com/u/blaizard)\
**Post date:** [May 15, 2022, 1:48pm UTC](https://forum.gitea.com/t/ldap-users-lost/5219/1 "2022-05-15T13:48:01Z")

</div>

Hi,

I changed my LDAP hostname address and now I cannot get back my users.  
I have 5-6 users that were created via LDAP, after changing the LDAP hostname, it tries to recreate the users but since they already exists, it fails:  
2022/05/15 15:40:05 …/ldap/source\_sync.go:120:Sync() [E] SyncExternalUsers[LDAP Synology]: Error creating user XXX: user already exists [name: XXX]

Not sure how to tell Gitea that those are the same users.  
Also another strange thing is now I cannot see the users if I do “gitea admin users list”,

Any idea how to fix this? Thanks!

---

<div class="post-metadata">

**Author:** ![dachary](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/dachary/32/4990_2.png) [@dachary](https://forum.gitea.com/u/dachary)\
**Post date:** [May 15, 2022, 2:19pm UTC](https://forum.gitea.com/t/ldap-users-lost/5219/2 "2022-05-15T14:19:00Z")

</div>

Can you add an entry to `/etc/hosts` with the name of the previous LDAP server but with the new IP so that Gitea knows it is the same?

---

<div class="post-metadata">

**Author:** ![blaizard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/blaizard/32/2664_2.png) [@blaizard](https://forum.gitea.com/u/blaizard)\
**Post date:** [May 15, 2022, 2:34pm UTC](https://forum.gitea.com/t/ldap-users-lost/5219/3 "2022-05-15T14:34:26Z")

</div>

It was a fixed IP previously and switch to a hostname now. So I don’t think I can do that with /etc/hosts

---

<div class="post-metadata">

**Author:** ![dachary](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/dachary/32/4990_2.png) [@dachary](https://forum.gitea.com/u/dachary)\
**Post date:** [May 15, 2022, 3:32pm UTC](https://forum.gitea.com/t/ldap-users-lost/5219/4 "2022-05-15T15:32:38Z")

</div>

The new hostname is converted to an IP, you just need to figure out which. Using

```auto
$ ping hostname

```

will tell you.

---

<div class="post-metadata">

**Author:** ![lunny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/lunny/32/4701_2.png) [@lunny](https://forum.gitea.com/u/lunny)\
**Post date:** [May 15, 2022, 4:48pm UTC](https://forum.gitea.com/t/ldap-users-lost/5219/5 "2022-05-15T16:48:28Z")

</div>

If you created a new auth source, the old users are still point to old auth source id with `login_type` and `login_id`. So they cannot be found. But I think it’s still a bug, the search condition is not same as creating condition.

---

<div class="post-metadata">

**Author:** ![99rgosse](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/99rgosse/32/1793_2.png) [@99rgosse](https://forum.gitea.com/u/99rgosse)\
**Post date:** [May 17, 2022, 1:37pm UTC](https://forum.gitea.com/t/ldap-users-lost/5219/6 "2022-05-17T13:37:46Z")

</div>

Have you tried to rename the old logins and old mail addresses ? You should be able to recreate the users then…
