You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: admin_manual/configuration_user/user_auth_ldap_cleanup.rst
+45-33Lines changed: 45 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,23 @@
2
2
LDAP user cleanup
3
3
=================
4
4
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
+
--------
12
7
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.
14
9
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.
19
22
20
23
There are two prerequisites for LDAP User Cleanup to operate:
21
24
@@ -28,31 +31,28 @@ There are two prerequisites for LDAP User Cleanup to operate:
28
31
server is not marked as ``deleted``.
29
32
30
33
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
32
37
users and your ``ldapUserCleanupInterval`` is 20 minutes, the process will
33
38
examine the first 50 users, then 20 minutes later the next 50 users, and 20
34
39
minutes later the next 50, and so on.
35
40
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
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
+
--------------------------------------
46
48
47
-
These examples are for Ubuntu Linux:
49
+
To review which accounts have been marked for deletion, you can use the following OCC command:
48
50
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``
51
52
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.
54
54
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::
@@ -67,14 +67,26 @@ This example shows what the table of users marked as ``deleted`` looks like::
67
67
Following flags can be specified additionally:
68
68
69
69
* ``--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**.
71
71
72
+
Manually Deleting User Accounts
73
+
------------------------------
72
74
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:
75
76
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
+
-----------------
78
85
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