nextcloud / nextcloud/server

[Bug]: Login for LDAP Users impossible after moving in LDAP

Open
#63,192 4 comments 0 reactions 1 assignee View on GitHub

@come-nc is already working on this.

Since Aug 20, 2026.

0. Needs triage 34-feedback bug
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

When moving users from an OU in a LDAP to another, they can only login once, on second try the login fails, because the LDAP request seems to use the old OU-path. Nothing else was changed.

The logs then provide the following message:
{"reqId":"dLQaQHOHPXBRxGQfbofe","level":0,"time":"2026-08-12T20:47:09+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"--","app":"user_ldap","method":"POST","url":"/index.php/login","scriptName":"/index.php","message":"Calling LDAP function ldap_bind with parameters ["(resource)","cn=USER.NAME,ou=OLD-OU,ou=STAFF,dc=DOMAINCONTROLLER,dc=TLD","REMOVED SENSITIVE VALUE"]","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0","version":"34.0.2.1","data":{"app":"user_ldap"}}
Then bind fails, because under this CN the user cannot be find anymore.

I am using PostgreSQL and looked up also the database, there the LDAP DN is correct.
Updated all users after moving with:
occ ldap:check-user --update --all-seen-users
Also rebooted the machine.

What I am also wondering about; when changing the user base-DN from dc=DOMAINCONTROLLER,dc=TLD (this base-DN is required, because there are users in different OUs) to OU=USERSdc=DOMAINCONTROLLER,dc=TLD in the plugins settings, then everything works fine?
it works fine again.

I cannot find from where the script takes this cache?

Steps to reproduce

Use LDAP plugin, move users in LDAP, then try to login with them.

Expected behavior

Simply use latest OU for user, to allow login.

Nextcloud Server version

34

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.4

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "overwriteprotocol": "https",
        "trusted_domains": [
            "sub.domain.tld",
            "sub1.domain.tld",
            "sub2.domain.tld"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/sub.domain.tld",
        "dbtype": "pgsql",
        "version": "34.0.2.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "proxy": "10.0.0.1:3128",
        "loglevel": 0,
        "maintenance": false,
        "maintenance_window_start": 1,
        "lost_password_link": "disabled",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "default_phone_region": "DE",
        "mail_smtpsecure": "ssl",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "auth.bruteforce.protection.enabled": false,
        "app_install_overwrite": [
            "radio",
            "dokuwiki",
            "dashboardcharts"
        ],
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory"
    }
}
List of activated Apps

Nextcloud Signing status
No errors have been found.
Nextcloud Logs

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.