Skip to content

[Bug]: NoUserException Backends provided no user object #292

@cdhermann

Description

@cdhermann

⚠️ This issue respects the following points: ⚠️

Bug description

After enabling the LDAP backend, logging in with a user of LDAP, removing the necessary group for login in LDAP and then removing the LDAP backend from Nextcloud causes the user to stay somehow in the system which causes flooding of the log with messages like this:

{
    "reqId": "azMwdqqlfa3Cmt6n1FhJ",
    "level": 3,
    "time": "2024-07-21T13:55:45+00:00",
    "remoteAddr": "",
    "user": "--",
    "app": "files",
    "method": "",
    "url": "--",
    "message": "Backends provided no user object for testuser_2438",
    "userAgent": "--",
    "version": "29.0.3.4",
    "exception": {
        "Exception": "OC\\User\\NoUserException",
        "Message": "Backends provided no user object",
        "Code": 0,
        "Trace": [
            {
                "function": "getUserFolder",
                "class": "OC\\Files\\Node\\Root",
                "type": "->",
                "args": [
                    "testuser_2438"
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyFolder.php",
                "line": 84,
                "function": "call_user_func_array",
                "args": [
                    [
                        [
                            "OC\\Files\\Node\\Root"
                        ],
                        "getUserFolder"
                    ],
                    [
                        "testuser_2438"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyRoot.php",
                "line": 53,
                "function": "__call",
                "class": "OC\\Files\\Node\\LazyFolder",
                "type": "->",
                "args": [
                    "getUserFolder",
                    [
                        "testuser_2438"
                    ]
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 558,
                "function": "getUserFolder",
                "class": "OC\\Files\\Node\\LazyRoot",
                "type": "->",
                "args": [
                    "testuser_2438"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 577,
                "function": "getFileFromId",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "testuser_2438",
                    685035
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 1288,
                "function": "getFileFromIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 707,
                "function": "updateDirectoryContentIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Provider/FilesProvider.php",
                "line": 314,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Service/IndexService.php",
                "line": 409,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Provider\\FilesProvider",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 109,
                "function": "updateDocument",
                "class": "OCA\\FullTextSearch\\Service\\IndexService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 77,
                "function": "liveCycle",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/Job.php",
                "line": 80,
                "function": "run",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": [
                    null
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 102,
                "function": "start",
                "class": "OCP\\BackgroundJob\\Job",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 92,
                "function": "start",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/cron.php",
                "line": 177,
                "function": "execute",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            }
        ],
        "File": "/var/www/html/lib/private/Files/Node/Root.php",
        "Line": 370,
        "message": "Backends provided no user object for testuser_2438",
        "exception": [],
        "CustomMessage": "Backends provided no user object for testuser_2438"
    },
    "id": "669d14ec6eb2b"
}

How do I get rid of this non-existing user testuser_2438?

Steps to reproduce

  1. Install Nextcloud AIO v9.2.0 (happend also with previous 9.x versions)
  2. Create a user called testuser and an arbitrary other user
  3. Participate in a Group Folder with the other user
  4. Share some files with the other user
  5. Install LLDAP (https://github.com/lldap/lldap) with ldaps-Support
  6. Enable the LDAP-Backend of Nextcloud
  7. Connect the Nextcloud LDAP backend to Nextcloud as decribed at https://github.com/lldap/lldap/blob/main/example_configs/nextcloud.md using ldaps
  8. Create a LDAP user called testuser
  9. log in with user testuser
  10. Wonder why there is a new user in addition to the existing testuser - with _<number> postfixed
  11. Realize the LDAP backend only works if installed from the very beginning without any user (from LDAP) being in the system
  12. Disable the LDAP backend
  13. Have a look at https://your-nextcloud-host/settings/users and you won't see the user mentioned in the error message
  14. Wait some time
  15. The logs will be flooded with error messages like "Backends provided no user object for testuser_2438"

Expected behavior

The really expected behaviour would be to join existing and ldap users as soon as Internal Username corresponds to the username and isn't UID.

After having learned the LDAP backend can't do it, the expected behavior is:
Deleting users deletes them really - no matter which backend added the user.

Installation method

Official All-in-One appliance

Nextcloud Server version

29

Operating system

RHEL/CentOS

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

PostgreSQL

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

Updated from a MINOR version (ex. 28.0.1 to 28.0.2)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "appsallowlist": false,
        "check_data_directory_permissions": false,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "collab.itbh.at",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "collab.itbh.at"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "29.0.3.4",
        "overwrite.cli.url": "https:\/\/collab.itbh.at\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "loglevel": "2",
        "log_type": "file",
        "logfile": "\/var\/www\/html\/data\/nextcloud.log",
        "log_rotate_size": "10485760",
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "enabledPreviewProviders": {
            "1": "OC\\Preview\\Image",
            "2": "OC\\Preview\\MarkDown",
            "3": "OC\\Preview\\MP3",
            "4": "OC\\Preview\\TXT",
            "5": "OC\\Preview\\OpenDocument",
            "6": "OC\\Preview\\Movie",
            "7": "OC\\Preview\\Krita",
            "0": "OC\\Preview\\Imaginary"
        },
        "enable_previews": true,
        "upgrade.disable-web": true,
        "mail_smtpmode": "smtp",
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 30",
        "activity_expire_days": "30",
        "simpleSignUpLink.shown": false,
        "share_folder": "\/Shared",
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "upgrade.cli-upgrade-link": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/2726",
        "updatedirectory": "\/nc-updater",
        "allow_local_remote_servers": true,
        "davstorage.request_timeout": 3600,
        "htaccess.RewriteBase": "\/",
        "dbpersistent": false,
        "files_external_allow_create_new_local": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED_FOR"
        ],
        "default_phone_region": "AT",
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "maintenance_window_start": 100,
        "preview_imaginary_key": "***REMOVED SENSITIVE VALUE***",
        "auth.bruteforce.protection.enabled": true,
        "ratelimit.protection.enabled": true,
        "app_install_overwrite": [
            "keeweb"
        ]
    }
}

List of activated Apps

Enabled:
  - activity: 2.21.1
  - admin_audit: 1.19.0
  - calendar: 4.7.12
  - circles: 29.0.0-dev
  - cloud_federation_api: 1.12.0
  - collectives: 2.12.0
  - comments: 1.19.0
  - contacts: 6.0.0
  - contactsinteraction: 1.10.0
  - dashboard: 7.9.0
  - dav: 1.30.1
  - deck: 1.13.1
  - drawio: 3.0.2
  - federatedfilesharing: 1.19.0
  - federation: 1.19.0
  - files: 2.1.0
  - files_antivirus: 5.5.7
  - files_downloadlimit: 2.0.0
  - files_external: 1.21.0
  - files_fulltextsearch: 29.0.0
  - files_pdfviewer: 2.10.0
  - files_reminders: 1.2.0
  - files_sharing: 1.21.0
  - files_trashbin: 1.19.0
  - files_versions: 1.22.0
  - files_zip: 1.5.0
  - firstrunwizard: 2.18.0
  - fulltextsearch: 29.0.0
  - fulltextsearch_elasticsearch: 29.0.1
  - groupfolders: 17.0.1
  - impersonate: 1.16.0
  - integration_google: 2.2.0
  - keeweb: 0.6.19
  - logreader: 2.14.0
  - lookup_server_connector: 1.17.0
  - mail: 3.7.5
  - nextcloud-aio: 0.6.0
  - nextcloud_announcements: 1.18.0
  - notes: 4.10.1
  - notifications: 2.17.0
  - notify_push: 0.6.12
  - oauth2: 1.17.0
  - password_policy: 1.19.0
  - photos: 2.5.0
  - privacy: 1.13.0
  - provisioning_api: 1.19.0
  - recommendations: 2.1.0
  - related_resources: 1.4.0
  - richdocuments: 8.4.3
  - serverinfo: 1.19.0
  - settings: 1.12.0
  - sharebymail: 1.19.0
  - spreed: 19.0.7
  - support: 1.12.0
  - survey_client: 1.17.0
  - systemtags: 1.19.0
  - text: 3.10.1
  - theming: 2.4.0
  - theming_customcss: 1.16.0
  - twofactor_backupcodes: 1.18.0
  - twofactor_totp: 11.0.0-dev
  - user_status: 1.9.0
  - viewer: 2.3.0
  - weather_status: 1.9.0
  - workflowengine: 2.11.0
Disabled:
  - analytics: 4.14.0 (installed 4.14.0)
  - bruteforcesettings: 2.9.0
  - encryption: 2.17.0
  - suspicious_login: 7.0.0 (installed 7.0.0)
  - tasks: 0.16.0 (installed 0.16.0)
  - user_ldap: 1.20.0 (installed 1.20.0)

Nextcloud Signing status

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- core
	- INVALID_HASH
		- core/js/mimetypelist.js
	- EXTRA_FILE
		- core/img/filetypes/dwb.svg
		- core/img/filetypes/drawio.svg

Raw output
==========
Array
(
    [core] => Array
        (
            [INVALID_HASH] => Array
                (
                    [core/js/mimetypelist.js] => Array
                        (
                            [expected] => 5b121122c0bec0580402c04605700056ee06eb553a4692bfc085ad3fc17aa49af43ca7795e98cbd22383020bfa9809bf3cc824b1673595f461479afb602bcec4
                            [current] => 3780abf2631567308dea2792113a813b71ed713c53769f4197a5e6205a4c2f1f6f6d84c8d58037e0a49b5148caf3be55276bf23f5e215e0e4d27cc8102c45b09
                        )

                )

            [EXTRA_FILE] => Array
                (
                    [core/img/filetypes/dwb.svg] => Array
                        (
                            [expected] => 
                            [current] => 43731dd5f17a048112ea5109b40b02ec019b3ee2324385a0f448e3bd2264cb13dc160ab018d893f92f8e2f168fd09009b51578c8c6b97a02a1617c67ac087701
                        )

                    [core/img/filetypes/drawio.svg] => Array
                        (
                            [expected] => 
                            [current] => 92e0974cf869bf8ab969c3442dc2b80d55fde36441d22924db74916a06b407520aa2a9dc39336f9157195ebede697ffac0e639360879255ab91932d406e1897d
                        )

                )

        )

)

Nextcloud Logs

{
    "reqId": "DsNVbZXwn6idJXPzewgp",
    "level": 3,
    "time": "2024-07-21T14:10:46+00:00",
    "remoteAddr": "",
    "user": "--",
    "app": "files",
    "method": "",
    "url": "--",
    "message": "Backends provided no user object for testuser_2438",
    "userAgent": "--",
    "version": "29.0.3.4",
    "exception": {
        "Exception": "OC\\User\\NoUserException",
        "Message": "Backends provided no user object",
        "Code": 0,
        "Trace": [
            {
                "function": "getUserFolder",
                "class": "OC\\Files\\Node\\Root",
                "type": "->",
                "args": [
                    "testuser_2438"
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyFolder.php",
                "line": 84,
                "function": "call_user_func_array",
                "args": [
                    [
                        [
                            "OC\\Files\\Node\\Root"
                        ],
                        "getUserFolder"
                    ],
                    [
                        "testuser_2438"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyRoot.php",
                "line": 53,
                "function": "__call",
                "class": "OC\\Files\\Node\\LazyFolder",
                "type": "->",
                "args": [
                    "getUserFolder",
                    [
                        "testuser_2438"
                    ]
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 558,
                "function": "getUserFolder",
                "class": "OC\\Files\\Node\\LazyRoot",
                "type": "->",
                "args": [
                    "testuser_2438"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 577,
                "function": "getFileFromId",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "testuser_2438",
                    685035
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 1288,
                "function": "getFileFromIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php",
                "line": 707,
                "function": "updateDirectoryContentIndex",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/files_fulltextsearch/lib/Provider/FilesProvider.php",
                "line": 314,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Service/IndexService.php",
                "line": 409,
                "function": "updateDocument",
                "class": "OCA\\Files_FullTextSearch\\Provider\\FilesProvider",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 109,
                "function": "updateDocument",
                "class": "OCA\\FullTextSearch\\Service\\IndexService",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/html/custom_apps/fulltextsearch/lib/Cron/Index.php",
                "line": 77,
                "function": "liveCycle",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": []
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/Job.php",
                "line": 80,
                "function": "run",
                "class": "OCA\\FullTextSearch\\Cron\\Index",
                "type": "->",
                "args": [
                    null
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 102,
                "function": "start",
                "class": "OCP\\BackgroundJob\\Job",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
                "line": 92,
                "function": "start",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/html/cron.php",
                "line": 177,
                "function": "execute",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args": [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            }
        ],
        "File": "/var/www/html/lib/private/Files/Node/Root.php",
        "Line": 370,
        "message": "Backends provided no user object for testuser_2438",
        "exception": [],
        "CustomMessage": "Backends provided no user object for testuser_2438"
    },
    "id": "669d18a4745f0"
}

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions