Error When Deleting User Using mmctl

Problem
Attempting to delete user via mmctl user delete fails with an error.

Environment
Mattermost Server with mmctl installed.

Diagnosis

ahmaddanial@mattermost:/opt/mattermost$ mmctl user delete ahmad.danial@mattermost.com
WARNING: server version 5.29.0.5.29.0.45a60588b1ed9e0018bed1e1377071b9.true doesn't match mmctl version 5.28.0
Have you performed a database backup? (YES/NO):
YES
Are you sure you want to delete the users specified? All data will be permanently deleted? (YES/NO):
YES
Unable to delete user 'ahmad.danial' error: : Permanent user deletion feature is not enabled. Please contact your System Administrator.,

Cause
The EnableAPIUserDeletion is set to false.

Resolution
Make the change to the parameter via config.json to set it to true before running the mmctl user delete command again:

ahmaddanial@mattermost:/opt/mattermost$ mmctl user delete ahmad.danial@mattermost.com
WARNING: server version 5.29.0.5.29.0.45a60588b1ed9e0018bed1e1377071b9.true doesn't match mmctl version 5.28.0
Have you performed a database backup? (YES/NO):
YES
Are you sure you want to delete the users specified? All data will be permanently deleted? (YES/NO):
YES
Deleted user 'ahmad.danial'
4 Likes

but even when it is set to true, this does only work in a standard installation and not inside a docker container installation with PostgreSQL database:

root@abc:/var/xyz/mattermost# docker-compose exec app sh
~ $ mmctl user delete u78yrxgftpg89bwijmy6ez98we --confirm --local
Unable to delete user ā€˜usernameā€™ error: : Konnte die zu lƶschenden Nachrichten fĆ¼r den Benutzer nicht auswƤhlen.,
(Could not select the messages for the user to delete)

I have enabled [EnableAPIUserDeletion] still it is showing the sameā€¦I have installed omni installationā€¦ After changing config file do i need to change anything?? I tried restarting it and reconfigure it but still showing same errorā€¦

Please take into account that Omnibus uses configuration in the database, so changing the config.json file has no effect on the applicationā€™s configuration.

Can you try to update the configuration running

mmctl config set ServiceSettings.EnableAPIUserDeletion true --local

and then try to delete a user again?

4 Likes

Thank you This worked

2 Likes

This was hard to find, I would like to put forward that it is published in the official documentation. Worked for me on the latest build.