We're Hiring!

Mattermost, Inc.

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'
3 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?

3 Likes

Thank you This worked

2 Likes