Mattermost: Advanced Mattermost administration with mmctl
This documentation is part of the Getting started guide. View the full guide here: How to get started with Mattermost.
Welcome to the Stackhero documentation
Stackhero delivers a production-ready Mattermost cloud environment designed for seamless collaboration and strong data protection. Key advantages include:
- Unlimited users and channels for unrestricted team growth.
- A dedicated SMTP email server with no additional limits, included by default.
- Full control over your domain name, secured automatically with HTTPS (such as https://chat.your-company.com).
- Hassle-free updates managed in a single click.
- High performance and advanced security on a private, dedicated infrastructure: your data stays isolated and confidential.
- Hosting available in both 🇪🇺 Europe and 🇺🇸 USA regions.
You can get started in just minutes. Stackhero handles setup, security, and operational management for your Mattermost cloud hosting, providing a secure and scalable collaboration platform with minimal effort.
For those who want to dive deeper, the mmctl CLI provides powerful tools to manage and configure your Mattermost instance. You can find more details in the official documentation: https://docs.mattermost.com/manage/mmctl-command-line-tool.html.
Using the CLI mmctl with Mattermost
You have the option to install mmctl on your computer or run it using Docker. We recommend using Docker. To launch a container with an interactive bash shell, you can run:
docker run -it mattermost/mattermost-team-edition:latest /bin/bash
To log in, establish a connection with your server by running:
mmctl auth login -n stackhero https://<XXXXXX>.stackhero-network.com
You will be prompted to enter your Mattermost credentials. Once logged in, you can perform various administrative tasks with the mmctl CLI.
If you use two-factor authentication and encounter the error "could not initiate client: Invalid MFA token", include your MFA token (the 6-digit code from your MFA app) by running:
mmctl auth login -n stackhero --mfa-token <XXXXXX> https://<XXXXXX>.stackhero-network.com
After successfully authenticating, you might list all Mattermost users with the following command:
mmctl user list
Deleting a Mattermost user using mmctl
Be cautious: this action will permanently delete the user and all associated data, and recovery is not possible.
While you can disable a user from the Mattermost System Console, deletion must be performed using the mmctl CLI. To delete a user, run:
mmctl user delete [email protected]
If you encounter the error "Permanent user deletion feature is not enabled. Please contact your System Administrator", enable user deletion via API support with:
mmctl config set ServiceSettings.EnableAPIUserDeletion true
Deleting a Mattermost channel using mmctl
You can delete a channel using the mmctl CLI.
Be cautious: this action will permanently delete the channel and all its data, and recovery is not possible.
To delete a channel, replace <TEAM> and <CHANNEL> with your specific values and execute:
mmctl channel delete <TEAM>:<CHANNEL>
If you encounter the error Permanent channel deletion feature is not enabled. Please contact your System Administrator., enable this feature by running:
mmctl config set ServiceSettings.EnableAPIChannelDeletion true