LDAP - Clearing Stale users and their data

Hi Guys,
I’m currently new to Owncloud by virtue of our old sys admin quitting and don’t know much about it but the situation we’re currently in is that we have run out of space on our /data partition and when looking at this partition I see many users who are no longer with the company. I’ve already done a user sync and cleared out user accounts that no longer have a back end connection through LDAP but some of the /data directories still linger. How can I clear this out without going one by one through Owncloud to remove these users?

You can try with occ user:delete. At least in OC 10.5 that command includes a -f option to force the deletion of missing users, which might fit in your use case.
In any case, you’ll need to delete the users one by one. I don’t know if you can wrap it into a script

1 Like

So I’m not missing any maintenance or automation here that can automatically clean up users who broken ldap ties. Deleted / disabled users through ldap must be manually cleared out? We have a lot of users that will need to be manually cleared out, doesn’t seem like a very feasible thing to do.

I’ve checked with a fresh 10.5 installation with a default configuration and the process works fine:

  1. Remove the user from the LDAP server
  2. Resync the backend via occ, choosing the “remove” option.

The data directory associated to the user is deleted. Even if you choose the “disable” option, you can still remove then in further iterations.

Since you haven’t posted your ownCloud version nor the relevant log entries, it isn’t possible to help you. Your installation could be old and have bugs, or something you did break something that now is preventing the proper deletion. However, as stated above, ownCloud 10.5 works fine.

1 Like