-
Notifications
You must be signed in to change notification settings - Fork 2.3k
docs(admin): clarify LDAP user cleanup and manual deletion process #13895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
joshtrichards
wants to merge
2
commits into
master
Choose a base branch
from
jtr/ldap-user-cleanup
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,20 +2,23 @@ | |
| LDAP user cleanup | ||
| ================= | ||
|
|
||
| LDAP User Cleanup is a new feature in the ``LDAP user and group backend`` | ||
| application. LDAP User Cleanup is a background process that automatically | ||
| searches the Nextcloud LDAP mappings table, and verifies if the LDAP users are | ||
| still available. Any users that are not available are marked as ``deleted`` in | ||
| the ``oc_preferences`` database table. Then you can run a command to display | ||
| this table, displaying only the users marked as ``deleted``, and then you have | ||
| the option of removing their data from your Nextcloud data directory. | ||
| Overview | ||
| -------- | ||
|
|
||
| These items are removed upon cleanup: | ||
| LDAP User Cleanup is a feature in the Nextcloud LDAP application. LDAP User Cleanup periodically and automatically runs in the background, checking the Nextcloud LDAP user mappings and verifying if mapped users are still available in your LDAP directory. Any accounts that are no longer found in LDAP are **marked for deletion** within Nextcloud—this prevents login for those users but does not immediately remove their data. | ||
|
|
||
| * Local Nextcloud group assignments | ||
| * User preferences (DB table ``oc_preferences``) | ||
| * User's Nextcloud home folder | ||
| * User's corresponding entry in ``oc_storages`` | ||
| .. note:: | ||
|
|
||
| LDAP User Cleanup does *not* immediately delete user accounts or data. When users are no longer found in LDAP, their accounts are **marked for deletion** within Nextcloud. At this stage, all account data—including files, folders, preferences, and group memberships—remains in place. The user is simply prevented from logging in. | ||
|
|
||
| Actual removal of user data occurs only when you manually delete the account (with ``occ user:delete [username]``). | ||
|
|
||
| Marking for deletion provides a safe review step for administrators prior to any irreversible action. | ||
|
|
||
| How LDAP User Cleanup Works | ||
| --------------------------- | ||
|
|
||
| When a user mapped in Nextcloud can no longer be found in the LDAP directory, their account is automatically marked for deletion by the cleanup job. This disables their login, but all files and account data remain present. | ||
|
|
||
| There are two prerequisites for LDAP User Cleanup to operate: | ||
|
|
||
|
|
@@ -28,31 +31,28 @@ There are two prerequisites for LDAP User Cleanup to operate: | |
| server is not marked as ``deleted``. | ||
|
|
||
| The background process examines 50 users at a time, and runs at the interval you | ||
| configured with ``ldapUserCleanupInterval``. For example, if you have 200 LDAP | ||
| configure with ``ldapUserCleanupInterval``. | ||
|
|
||
| For example, if you have 200 LDAP | ||
| users and your ``ldapUserCleanupInterval`` is 20 minutes, the process will | ||
| examine the first 50 users, then 20 minutes later the next 50 users, and 20 | ||
| minutes later the next 50, and so on. | ||
|
|
||
| The amount of users to check can be set to a custom value via occ command. The | ||
| The amount of users to check can be set to a custom value via OCC. The | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we using this uppercase version in the rest of the documentation 🤔 |
||
| following example sets it to 300: | ||
|
|
||
| ``sudo -E -u www-data php occ config:app:set --value=300 user_ldap cleanUpJobChunkSize`` | ||
| ``occ config:app:set --value=300 user_ldap cleanUpJobChunkSize`` | ||
|
|
||
| There are two ``occ`` commands to use for examining a table of users marked as | ||
| deleted, and then manually deleting them. The ``occ`` command is in your | ||
| Nextcloud directory, for example ``/var/www/nextcloud/occ``, and it must be run as | ||
| your HTTP user. To learn more about ``occ``, see | ||
| :doc:`../occ_command`. | ||
| Reviewing Accounts Marked for Deletion | ||
| -------------------------------------- | ||
|
|
||
| These examples are for Ubuntu Linux: | ||
| To review which accounts have been marked for deletion, you can use the following OCC command: | ||
|
|
||
| 1. ``sudo -E -u www-data php occ ldap:show-remnants`` displays a table with all | ||
| users that have been marked as deleted, and their LDAP data. | ||
| ``occ ldap:show-remnants`` | ||
|
|
||
| 2. ``sudo -E -u www-data php occ user:delete [user]`` removes the user's data from the | ||
| Nextcloud data directory. | ||
| This command will display a list of user accounts that have been flagged by LDAP User Cleanup. You can check this list before proceeding with account removal. | ||
|
|
||
| This example shows what the table of users marked as ``deleted`` looks like:: | ||
| This example shows what a table of users marked for deletion looks like:: | ||
|
|
||
| $ sudo -E -u www-data php occ ldap:show-remnants | ||
| +-----------------+-----------------+------------------+--------------------------------------+ | ||
|
|
@@ -67,14 +67,26 @@ This example shows what the table of users marked as ``deleted`` looks like:: | |
| Following flags can be specified additionally: | ||
|
|
||
| * ``--short-date``: formats the dates for ``Last login`` and ``Detected on`` in a short Y-m-d format (e.g. 2019-01-14) | ||
| * ``--json``: instead of a table, the output is json-encoded. This makes it easy to process the data programmatically. | ||
| * ``--json``: instead of a table, the output is json-encoded. **This makes it easy to process the data programmatically if desired**. | ||
|
|
||
| Manually Deleting User Accounts | ||
| ------------------------------- | ||
|
|
||
| After reviewing the users that have been marked for deletion, you can manually remove an account and all its data using: | ||
|
|
||
| ``occ user:delete [username]`` | ||
|
|
||
| This command will permanently delete the specified user’s data from Nextcloud. Be sure to only run this on users you intend to fully remove. | ||
|
|
||
| For example, given the earlier example remnants output you might choose to run ``occ user:delete aaliyah_brown`` to delete user ``aaliyah_brown``. You must use the user's Nextcloud name. | ||
|
|
||
| Then you can run ``sudo -E -u www-data php occ user:delete aaliyah_brown`` to delete | ||
| user aaliyah_brown. You must use the user's Nextcloud name. | ||
| What Gets Deleted | ||
| ----------------- | ||
|
|
||
| Deleting local Nextcloud users | ||
| ------------------------------ | ||
| The following items are removed **only when you manually delete** a user account that has been marked for deletion by the LDAP User Cleanup process: | ||
|
|
||
| You may also use ``occ user:delete [user]`` to remove a local Nextcloud user; | ||
| this removes their user account and their data. | ||
| * Local Nextcloud group assignments | ||
| * User preferences (DB table ``oc_preferences``) | ||
| * User's Nextcloud home folder | ||
| * User's corresponding entry in ``oc_storages`` | ||
| * Other app specific data (app implementation dependent) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking for deletion does not prevent login per-se.
Users cannot login anymore because they do not match the login filter anymore.
When using another login method there have been issues in the past where the users could login. It’s usually either a bug or misconfiguration though.
Users which are marked as deleted will also disappear from user listing in Nextcloud. I think that’s important to note. In the UI it looks like the user is gone.