Skip to content

Commit fdbc1e8

Browse files
docs(admin): clarify LDAP user cleanup and manual deletion process
Signed-off-by: Josh <[email protected]>
1 parent 8007477 commit fdbc1e8

File tree

1 file changed

+45
-33
lines changed

1 file changed

+45
-33
lines changed

admin_manual/configuration_user/user_auth_ldap_cleanup.rst

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22
LDAP user cleanup
33
=================
44

5-
LDAP User Cleanup is a new feature in the ``LDAP user and group backend``
6-
application. LDAP User Cleanup is a background process that automatically
7-
searches the Nextcloud LDAP mappings table, and verifies if the LDAP users are
8-
still available. Any users that are not available are marked as ``deleted`` in
9-
the ``oc_preferences`` database table. Then you can run a command to display
10-
this table, displaying only the users marked as ``deleted``, and then you have
11-
the option of removing their data from your Nextcloud data directory.
5+
Overview
6+
--------
127

13-
These items are removed upon cleanup:
8+
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.
149

15-
* Local Nextcloud group assignments
16-
* User preferences (DB table ``oc_preferences``)
17-
* User's Nextcloud home folder
18-
* User's corresponding entry in ``oc_storages``
10+
.. note::
11+
12+
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.
13+
14+
Actual removal of user data occurs only when you manually delete the account (with ``occ user:delete [username]``).
15+
16+
Marking for deletion provides a safe review step for administrators prior to any irreversible action.
17+
18+
How LDAP User Cleanup Works
19+
---------------------------
20+
21+
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.
1922

2023
There are two prerequisites for LDAP User Cleanup to operate:
2124

@@ -28,31 +31,28 @@ There are two prerequisites for LDAP User Cleanup to operate:
2831
server is not marked as ``deleted``.
2932

3033
The background process examines 50 users at a time, and runs at the interval you
31-
configured with ``ldapUserCleanupInterval``. For example, if you have 200 LDAP
34+
configure with ``ldapUserCleanupInterval``.
35+
36+
For example, if you have 200 LDAP
3237
users and your ``ldapUserCleanupInterval`` is 20 minutes, the process will
3338
examine the first 50 users, then 20 minutes later the next 50 users, and 20
3439
minutes later the next 50, and so on.
3540

36-
The amount of users to check can be set to a custom value via occ command. The
41+
The amount of users to check can be set to a custom value via OCC. The
3742
following example sets it to 300:
3843

39-
``sudo -E -u www-data php occ config:app:set --value=300 user_ldap cleanUpJobChunkSize``
44+
``occ config:app:set --value=300 user_ldap cleanUpJobChunkSize``
4045

41-
There are two ``occ`` commands to use for examining a table of users marked as
42-
deleted, and then manually deleting them. The ``occ`` command is in your
43-
Nextcloud directory, for example ``/var/www/nextcloud/occ``, and it must be run as
44-
your HTTP user. To learn more about ``occ``, see
45-
:doc:`../occ_command`.
46+
Reviewing Accounts Marked for Deletion
47+
--------------------------------------
4648

47-
These examples are for Ubuntu Linux:
49+
To review which accounts have been marked for deletion, you can use the following OCC command:
4850

49-
1. ``sudo -E -u www-data php occ ldap:show-remnants`` displays a table with all
50-
users that have been marked as deleted, and their LDAP data.
51+
``occ ldap:show-remnants``
5152

52-
2. ``sudo -E -u www-data php occ user:delete [user]`` removes the user's data from the
53-
Nextcloud data directory.
53+
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.
5454

55-
This example shows what the table of users marked as ``deleted`` looks like::
55+
This example shows what a table of users marked for deletion looks like::
5656

5757
$ sudo -E -u www-data php occ ldap:show-remnants
5858
+-----------------+-----------------+------------------+--------------------------------------+
@@ -67,14 +67,26 @@ This example shows what the table of users marked as ``deleted`` looks like::
6767
Following flags can be specified additionally:
6868

6969
* ``--short-date``: formats the dates for ``Last login`` and ``Detected on`` in a short Y-m-d format (e.g. 2019-01-14)
70-
* ``--json``: instead of a table, the output is json-encoded. This makes it easy to process the data programmatically.
70+
* ``--json``: instead of a table, the output is json-encoded. **This makes it easy to process the data programmatically if desired**.
7171

72+
Manually Deleting User Accounts
73+
------------------------------
7274

73-
Then you can run ``sudo -E -u www-data php occ user:delete aaliyah_brown`` to delete
74-
user aaliyah_brown. You must use the user's Nextcloud name.
75+
After reviewing the users that have been marked for deletion, you can manually remove an account and all its data using:
7576

76-
Deleting local Nextcloud users
77-
------------------------------
77+
``occ user:delete [username]``
78+
79+
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.
80+
81+
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.
82+
83+
What Gets Deleted
84+
-----------------
7885

79-
You may also use ``occ user:delete [user]`` to remove a local Nextcloud user;
80-
this removes their user account and their data.
86+
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:
87+
88+
* Local Nextcloud group assignments
89+
* User preferences (DB table ``oc_preferences``)
90+
* User's Nextcloud home folder
91+
* User's corresponding entry in ``oc_storages``
92+
* Other app specific data (app implementation dependent)

0 commit comments

Comments
 (0)