I’m using LDAP authentication. If I try to delete user which appear in the remnants table like this

sudo -u www-data php occ user:delete 8F8EAC24-BC01-49D7-A77C-AD3221099998

I get this message:

[OC\User\NoUserException] 8F8EAC24-BC01-49D7-A77C-AD3221099998 is not a valid user anymore


Nextcloud version: 12
Operating system and version: Ubuntu 16.04
Apache or nginx version: apache 2.4.18
PHP version: 7.0.18
Is this the first time you’ve seen this error: After updating to nextcloud 12
The output of your Nextcloud log in Admin > Logging: no enteries in logfile
The output of your Apache/nginx/system log in /var/log/____: no enteries

Remember, this information may be requested if it isn’t supplied; for fastest response please provide as much as you can :heart: Feel free to use a pastebin service, otherwise log files can be indented with 4 spaces on each line to present them in a friendlier way on the forum.

Now I’m running Nextcloud 12.03 and the problem is still there.
Any solutions?


I do seem to have the same issue and just as of yesterday, I write a little shell script, to work around that. I have tried it on our test server, where we had 1600+ deleted LDAP users, which had accumulated for about 2 years. :wink:

See here: https://help.nextcloud.com/t/cant-get-rid-of-ldap-users-and-files-from-them/22178/4

I do think, we need to raise in issue for NC core for this, though.

I just checked the issues for NC core and found, that there is something in the works, regarding this issue. More details can be found here:


Afaiks, this is targeted towards NC 12.0.4

Today, I updated our NC to 12.0.4 and I was finally able to remove 1600+ old ldap user accounts from our NC instance. It boiled down to this simple for loop in bash:

for i in sudo -u apache php occ ldap:show-remnants | awk -F "| " '{print $2}'; do echo “Delete user: $i”; sudo -u apache php occ user:delete $i; done

1 Like

For some weird reason bash didn’t like the double quotes so I had to adapt:

for i in $(php occ ldap:show-remnants | awk -F'| ' '{print $2}'); do
    echo "Delete user: $i"
    php occ user:delete $i

Note that I run this as a script as user www-data. YMMV

1 Like