mmctl Command Line Tool (Beta)

The mmctl tool is a remote CLI tool for Mattermost which is installed locally and uses the Mattermost API. Authentication is done with either login credentials or an authentication token.

Being installed locally allows a System Admin to run CLI commands even in instances where there is no access to the server (e.g., via SSH). This tool is currently in beta and can be used alongside the Mattermost CLI tool. In the future, the Mattermost CLI tool will be deprecated.

This feature was developed to a large extent by community contributions and we’d like to extend our gratitude to the contributors who have worked on this project. We are currently accepting pull requests for Help Wanted issues in the mattermost-server repo. You can learn more about the unit test coverage campaign for mmctl in the Unit testing mmctl commands blog post.

Notes

  • Parameters in CLI commands are order-specific.
  • If special characters (!, |, (, ), \, ', and ") are used, the entire argument needs to be surrounded by single quotes (e.g. -password 'mypassword!', or the individual characters need to be escaped out (e.g. password mypassword\!).
  • Team name and channel name refer to the handles, not the display names. So in the URL https://community.mattermost.com/core/channels/town-square team name would be core and channel name would be town-square.

Options

--format string               the format of the command output [plain, json] (default "plain")
-h, --help                    help for mmctl
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one
Commands

Installing mmctl

There are different methods available to install mmctl.

Using brew (Linux, macOS)

Use this option on Linux and macOS if you have Homebrew installed.

brew install mmctl

Using go get (Linux, macOS, Windows)

Use this option on Linux, macOS, and Windows if you have a go environment configured.

To add the project in your $GOPATH run the following command:

go get -u github.com/mattermost/mmctl

Using release package (Linux, macOS, Windows)

Vist the mmctl releases page and download the appropriate release for your OS, and install the binary.

Building mmctl

The mmctl tool uses go modules to manage dependencies, so you need to have installed go 1.11 or greater and compile the binary using:

make build

Authenticating and logging in

mmctl auth

Description

Manages the credentials and authentication methods of the remote Mattermost instances.

Options

-h, --help   help for auth

mmctl auth clean

Description

Clean the credentials associated with a Mattermost instance.

Format

mmctl auth clean [flags]

Examples

auth clean

Options

-h, --help   help for clean

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl auth current

Description

Show the currently stored user credentials.

Format

mmctl auth current [flags]

Examples

auth current

Options

-h, --help   help for current

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl auth delete

Description

Delete a named credential.

Format

mmctl auth delete [server name] [flags]

Examples

auth delete local-server

Options

-h, --help   help for delete

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl auth list

Description

Print a list of registered credentials.

Format

mmctl auth list [flags]

Examples

auth list

Options

-h, --help   help for list

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl auth login

Description

Log in to an instance and store credentials.

Format

mmctl auth login [instance url] --name [server name] --username [username] --password [password] [flags]

Examples

auth login https://mattermost.example.com
auth login https://mattermost.example.com --name local-server --username sysadmin --password mysupersecret
auth login https://mattermost.example.com --name local-server --username sysadmin --password mysupersecret --mfa-token 123456
auth login https://mattermost.example.com --name local-server --access-token myaccesstoken

Options

-a, --access-token string   Access token to use instead of username/password
-h, --help                  help for login
-m, --mfa-token string      MFA token for the credentials
-n, --name string           Name for the credentials
--no-activate               If present, it won't activate the credentials after login
-p, --password string       Password for the credentials
-u, --username string       Username for the credentials

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl auth renew

Description

Renew the credentials for a given server.

Format

mmctl auth renew [flags]

Examples

auth renew local-server

Options

-a, --access-token string   Access token to use instead of username/password
-h, --help                  help for renew
-m, --mfa-token string      MFA token for the credentials
-p, --password string       Password for the credentials

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl auth set

Description

Set credentials to use in the following commands.

Format

mmctl auth set [server name] [flags]

Examples

auth set local-server

Options

-h, --help   help for set

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

Authenticate to a server (e.g. >mmctl auth login https://test.mattermost.com), then enter your username and password (and MFA token if MFA is enabled on the account).

Password

$ mmctl auth login https://community.mattermost.com --name community --username my-username --password mysupersecret

The login command can also work interactively, so if you leave any required flag empty, mmctl will ask you for it interactively:

$ mmctl auth login https://community.mattermost.com
Connection name: community
Username: my-username
Password:

MFA

To log in with MFA, use the --mfa-token flag:

$ mmctl auth login https://community.mattermost.com --name community --username my-username --password mysupersecret --mfa-token 123456

Access tokens

You can generate and use a personal access token to authenticate with a server, instead of using username and password to log in:

$ mmctl auth login https://community.mattermost.com --name community --access-token MY_ACCESS_TOKEN

Alternatively, you can log in to your Mattermost server with a username and password:

$ mmctl auth login https://my-instance.example.com --name my-instance --username john.doe --password mysupersecret
credentials for my-instance: john.doe@https://my-instance.example.com stored

We can check the currently stored credentials with:

$ mmctl auth list

| Active |        Name | Username |                     InstanceUrl |
|--------|-------------|----------|---------------------------------|
|      * | my-instance | john.doe | https://my-instance.example.com |

And now we can run commands normally:

$ mmctl user search john.doe
id: qykfw3t933y38k57ubct77iu9c
username: john.doe
nickname:
position:
first_name: John
last_name: Doe
email: john.doe@example.com
auth_service:

Installing shell completions

To install the shell completions for bash, add the following line to your ~/.bashrc or ~/.profile file:

source <(mmctl completion bash)

For zsh, add the following line to your ~/.zshrc file:

source <(mmctl completion zsh)

mmctl bot

Management of bots.

Child Commands

Options

-h, --help   help for bot

mmctl bot create

Description

Create a bot.

Format

mmctl bot create [username] [flags]

Examples

bot create testbot

Options

--description string    Optional. The description text for the new bot.
--display-name string   Optional. The display name for the new bot.
-h, --help              help for create

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl channel

Commands for channel management.

Child Commands

Options

-h, --help   help for channel

mmctl channel add

Description

Add users to a channel. If adding multiple users, use a space-separated list.

Format

mmctl channel add [channel] [users] [flags]

Examples

channel add myteam:mychannel user@example.com username

Options

-h, --help   help for add

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl channel archive

Description

Archive one or multiple channels along with all related information including posts from the database. Channels can be specified by [team]:[channel] (i.e., myteam:mychannel) or by channel ID).

Format

mmctl channel archive [channels] [flags]

Examples

channel archive myteam:mychannel

Options

-h, --help   help for archive

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl channel create

Description

Create a channel.

Format

mmctl channel create [flags]

Examples

channel create --team myteam --name mynewchannel --display_name "My New Channel"
channel create --team myteam --name mynewprivatechannel --display_name "My New Private Channel" --private

Options

--display_name string   Channel Display Name
--header string         Channel header
-h, --help              help for create
--name string           Channel Name
--private               Create a private channel
--purpose string        Channel purpose
--team string           Team name or ID

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl channel list

Description

List all public and archived channels on specified teams. Archived channels are appended with ‘(archived)’.

Format

mmctl channel list [teams] [flags]

Examples

channel list myteam

Options

-h, --help   help for list

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl channel make_private

Description

Set the type of a channel from public to private. Channel can be specified by [team]:[channel] (i.e., myteam:mychannel) or by channel ID.

Format

mmctl channel make_private [channel] [flags]

Examples

channel make_private myteam:mychannel

Options

-h, --help   help for make_private

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl channel modify

Description

Change the public/private type of a channel. Channel can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.

Format

mmctl channel modify [channel] [flags]

Examples

channel modify myteam:mychannel --private
channel modify channelId --public

Options

-h, --help    help for modify
  --private   Convert the channel to a private channel
  --public    Convert the channel to a public channel

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl channel remove

Description

Remove specified users from a channel.

Format

mmctl channel remove [channel] [users] [flags]

Examples

channel remove myteam:mychannel user@example.com username
channel remove myteam:mychannel --all-users

Options

--all-users   Remove all users from the indicated channel
-h, --help    help for remove

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl channel rename

Description

Rename a channel.

Format

mmctl channel rename [flags]

Examples

channel rename myteam:mychannel newchannelname --display_name "New Display Name"

Options

--display_name string   Channel Display Name
-h, --help              help for rename

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl channel restore

Description

Restore a previously deleted channel. Channels can be specified by [team]:[channel] (e.g., myteam:mychannel) or by channel ID.

Format

mmctl channel restore [channels] [flags]

Examples

channel restore myteam:mychannel

Options

-h, --help   help for restore

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl command

Management of slash commands.

Child Commands

Options

-h, --help      help for command

mmctl command archive

Dscription

Archive a slash command. Commands can be specified by command ID.

Format

mmctl command archive [commandID] [flags]

Examples

command archive commandID

Options

-h, --help   help for archive

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl command create

Description

Create a custom slash command for the specified team.

Format

mmctl command create [team] [flags]

Examples

command create myteam --title MyCommand --description "My Command Description" --trigger-word mycommand --url http://localhost:8000/my-slash-handler --creator myusername --response-username my-bot-username --icon http://localhost:8000/my-slash-handler-bot-icon.png --autocomplete --post

Options

--autocomplete               Show Command in autocomplete list
--autocompleteDesc string    Short Command Description for autocomplete list
--autocompleteHint string    Command Arguments displayed as help in autocomplete list
--creator string             Command Creator's Username (required)
--description string         Command Description
-h, --help                   help for create
--icon string                Command Icon URL
--post                       Use POST method for Callback URL
--response-username string   Command Response Username
--title string               Command Title
--trigger-word string        Command Trigger Word (required)
--url string                 Command Callback URL (required)

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl command delete

Dscription

Delete a slash command. Commands can be specified by command ID.

Format

mmctl command delete [flags]

Examples

command delete commandID

Options

-h, --help   help for delete

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl command list

Description

List all commands on specified teams.

Format

mmctl command list [flags]

Examples

command list myteam

Options

-h, --help   help for list

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl command modify

Description

Modify a slash command. Commands can be specified by command ID.

Format

mmctl command modify [commandID] [flags]

Examples

command modify commandID --title MyModifiedCommand --description "My Modified Command Description" --trigger-word mycommand --url http://localhost:8000/my-slash-handler --creator myusername --response-username my-bot-username --icon http://localhost:8000/my-slash-handler-bot-icon.png --autocomplete --post

Options

--autocomplete               Show Command in autocomplete list
--autocompleteDesc string    Short Command Description for autocomplete list
--autocompleteHint string    Command Arguments displayed as help in autocomplete list
--creator string             Command Creator's username, email or id (required)
--description string         Command Description
-h, --help                   help for modify
--icon string                Command Icon URL
--post                       Use POST method for Callback URL
--response-username string   Command Response Username
--title string               Command Title
--trigger-word string        Command Trigger Word (required)
--url string                 Command Callback URL (required)

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl command move

Description

Move a slash command to a different team. Commands can be specified by command ID.

Format

mmctl command move [team] [commandID] [flags]

Examples

command move newteam commandID

Options

-h, --help   help for move

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl command show

Description

Show a custom slash command. Commands can be specified by command ID. Returns command ID, team ID, trigger word, display name and creator username.

Format

mmctl command [commandID] [flags]

Examples

command show commandID

Options

-h, --help   help for show

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl config

Configuration settings.

Child Commands

Options

-h, --help   help for config

mmctl config edit

Description

Opens the editor defined in the EDITOR environment variable to modify the server’s configuration and then uploads it.

Format

mmctl config edit [flags]

Examples

config edit

Options

-h, --help   help for edit

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl config get

Description

Gets the value of a config setting by its name in dot notation.

Format

mmctl config get [flags]

Examples

config get SqlSettings.DriverName

Options

-h, --help   help for get

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl config reset

Description

Resets the value of a config setting by its name in dot notation or a setting section. Accepts multiple values for array settings.

Format

mmctl config reset [flags]

Examples

config reset SqlSettings.DriverName LogSettings

Options

--confirm   Confirm you really want to reset all configuration settings to its default value
-h, --help  help for reset

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl config set

Description

Sets the value of a config setting by its name in dot notation. Accepts multiple values for array settings.

Format

mmctl config set [flags]

Examples

config set SqlSettings.DriverName mysql

Options

-h, --help   help for set

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl config show

Description

Prints the server configuration and writes to STDOUT in JSON format.

Format

mmctl config show [flags]

Examples

config show

Options

-h, --help   help for show

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl docs

Description

Generates mmctl documentation

Format

mmctl docs [flags]

Options

-d, --directory string   The directory where the docs would be generated in. (default "docs")
-h, --help               help for docs

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl group

Management of groups (channel and teams).

Child Commands

mmctl group channel

Management of channel groups

Child Commands

Options

-h, --help   help for group

mmctl group channel disable

Description

Disables group constrains in the specified channel.

Format

mmctl group channel disable [team]:[channel] [flags]

Examples

group channel disable myteam:mychannel

Options

-h, --help   help for disable

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl group channel enable

Description

Enables group constrains in the specified channel.

Format

mmctl group channel enable [team]:[channel] [flags]

Examples

group channel enable myteam:mychannel

Options

-h, --help   help for enable

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl group channel list

Description

List the groups associated with a channel.

Format

mmctl group channel list [team]:[channel] [flags]

Examples

group channel list myteam:mychannel

Options

-h, --help   help for list

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl group channel status

Description

Shows the group constrain status for the specified channel.

Format

mmctl group channel status [team]:[channel] [flags]

Examples

group channel status myteam:mychannel

Options

-h, --help   help for status

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl group team

Management of team groups.

Child Commands

Options

-h, --help   help for group

mmctl group team disable

Description

Disables group constrains in the specified team.

Format

mmctl group team disable [team] [flags]

Examples

group team disable myteam

Options

-h, --help   help for disable

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl group team enable

Description

Enables group constrains in the specified team.

Format

mmctl group team enable [team] [flags]

Examples

group team enable myteam

Options

-h, --help   help for enable

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl group team list

Description

List the groups associated with a team.

Format

mmctl group team list [team] [flags]

Examples

group team list myteam

Options

-h, --help   help for list

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl group team status

Description

Shows the group constrain status for the specified team.

Format

mmctl group team status [team] [flags]

Examples

group channel status myteam

Options

-h, --help   help for status

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl group list-ldap

Description

List LDAP groups.

Format

mmctl group list-ldap [flags]

Examples

group list-ldap

Options

-h, --help   help for list-ldap

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl ldap

LDAP-related utilities.

Child Commands

Options

-h, --help   help for ldap

mmctl ldap sync

Description

Synchronize all LDAP users and groups now.

Format

mmctl ldap sync [flags]

Examples

ldap sync

Options

-h, --help   help for sync

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl license

Licensing management commands.

Child Commands

Options

-h, --help   help for license

mmctl license remove

Description

Remove the current license and use Mattermost in Team Edition.

Format

mmctl license remove [flags]

Examples

license remove

Options

-h, --help   help for remove

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl license upload

Description

Upload a license. Replaces current license.

Format

mmctl license upload [license] [flags]

Examples

license upload /path/to/license/mylicensefile.mattermost-license

Options

-h, --help   help for upload

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl logs

Description

Display logs in a human-readable format

Format

mmctl logs [flags]

Options

-h, --help         help for logs
-l, --logrus       Use logrus for formatting
-n, --number int   Number of log lines to retrieve (default 200)

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl permissions

Management of permissions and roles.

Child Commands

Options

-h, --help   help for permissions

mmctl permissions add

Description

Add one or more permissions to an existing role (only available in E10 and E20).

Format

mmctl permissions add [role] [permission...] [flags]

Examples

permissions add system_user list_open_teams

Options

-h, --help   help for add

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl permissions remove

Description

Remove one or more permissions from an existing role (only available in E10 and E20).

Format

mmctl permissions remove [role] [permission...] [flags]

Examples

permissions remove system_user list_open_teams

Options

-h, --help   help for remove

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl permissions show

Description

Show all the information about a role.

Format

mmctl permissions show [role_name] [flags]

Examples

permissions show system_user

Options

-h, --help   help for show

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl plugin

Management of plugins.

Child Commands

Options

-h, --help   help for plugin

mmctl plugin add

Description

Add plugins to your Mattermost server.

Format

mmctl plugin add [plugins] [flags]

Examples

plugin add hovercardexample.tar.gz pluginexample.tar.gz

Options

-h, --help   help for add

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl plugin delete

Description

Delete previously uploaded plugins from your Mattermost server.

Format

mmctl plugin delete [plugins] [flags]

Examples

plugin delete hovercardexample pluginexample

Options

-h, --help   help for delete

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl plugin disable

Description

Disable plugins. Disabled plugins are immediately removed from the user interface and logged out of all sessions.

Format

mmctl plugin disable [plugins] [flags]

Examples

plugin disable hovercardexample pluginexample

Options

-h, --help   help for disable

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl plugin enable

Description

Enable plugins for use on your Mattermost server.

Format

mmctl plugin enable [plugins] [flags]

Examples

plugin enable hovercardexample pluginexample

Options

-h, --help   help for enable

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl plugin list

Description

List all active and inactive plugins installed on your Mattermost server.

Format

mmctl plugin list [flags]

Examples

plugin list

Options

-h, --help   help for list

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl post

Management of posts.

Child Commands

Options

-h, --help   help for post

mmctl post create

Description

Create a post.

Format

mmctl post create [flags]

Examples

post create myteam:mychannel --message "some text for the post"

Options

-h, --help              help for create
-m, --message string    Message for the post
-r, --reply-to string   Post id to reply to

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl post list

Description

List posts for a channel.

Format

mmctl post list [flags]

Examples

post list myteam:mychannel
post list myteam:mychannel --number 20

Options

-f, --follow       Output appended data as new messages are posted to the channel
-h, --help         help for list
-n, --number int   Number of messages to list (default 20)
-i, --show-ids     Show posts ids

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl roles

This command will be available in a future release.

mmctl system

System management commands for interacting with the server state and configuration.

Child Commands

Options

-h, --help   help for system

Options Inherited from Parent Commands

--format string                the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate   allows to use insecure TLS protocols, such as SHA-1
--strict                       will only run commands if the mmctl version matches the server one

mmctl system clearbusy

Description

Clear the busy state which re-enables non-critical services.

Format

mmctl system clearbusy [flags]

Examples

system clearbusy

Options

-h, --help   help for clearbusy

Options Inherited from Parent Commands

--format string                the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate   allows to use insecure TLS protocols, such as SHA-1
--strict                       will only run commands if the mmctl version matches the server one

mmctl system getbusy

Description

Gets the server busy state (high load) and timestamp corresponding to when the server busy flag will be automatically cleared.

Format

mmctl system getbusy [flags]

Examples

system getbusy

Options

-h, --help   help for getbusy

Options Inherited from Parent Commands

--format string                the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate   allows to use insecure TLS protocols, such as SHA-1
--strict                       will only run commands if the mmctl version matches the server one

mmctl system setbusy

Description

Set the busy state to true for the specified number of seconds, which disables non-critical services.

Format

mmctl system setbusy -s [seconds] [flags]

Examples

system setbusy -s 3600

Options

-h, --help   help for setbusy
-s, --seconds uint   Number of seconds until server is automatically marked as not busy. (default 3600)

Options Inherited from Parent Commands

--format string                the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate   allows to use insecure TLS protocols, such as SHA-1
--strict                       will only run commands if the mmctl version matches the server one

mmctl team

Management of teams.

Child Commands

Options

-h, --help   help for team

mmctl team archive

Description

Archives a team along with all related information including posts from the database.

Format

mmctl team archive [teams] [flags]

Examples

team archive myteam

Options

--confirm   Confirm you really want to archive the team and a DB backup has been performed.
-h, --help   help for archive

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl team create

Description

Create a team.

Format

mmctl team create [flags]

Examples

team create --name mynewteam --display_name "My New Team"
team create --name private --display_name "My New Private Team" --private

Options

--display_name string   Team Display Name
--email string          Administrator Email (anyone with this email is automatically a team admin)
-h, --help              help for create
--name string           Team Name
--private               Create a private team

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl team delete

Description

Permanently deletes a team along with all related information including posts from the database.

Format

mmctl team delete [teams] [flags]

Examples

team delete myteam

Options

--confirm   Confirm you really want to delete the team and a DB backup has been performed
-h, --help  help for delete

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl team list

Description

List all teams on the server.

Format

mmctl team list [flags]

Examples

team list

Options

-h, --help  help for list

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl team rename

Description

Rename an existing team.

Format

mmctl team rename [team] [flags]

Examples

team rename old-team --display_name 'New Display Name'

Options

--display_name string Team Display Name
-h, --help            help for rename

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl team users

Child Commands

mmctl team users add

Description

Add specified users to a team.

Format

mmctl team users add [team] [users] [flags]

Examples

team add myteam user@example.com username

Options

-h, --help  help for add

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl team users remove

Description

Remove some users from a team.

Format

mmctl team users remove [team] [users] [flags]

Examples

team remove myteam user@example.com username

Options

-h, --help  help for remove

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl user

Management of users.

Child Commands

Options

-h, --help       help for user

mmctl user activate

Description

Activate users that have been deactivated.

Format

mmctl user activate [emails, usernames, userIds] [flags]

Examples

user activate user@example.com
user activate username

Options

-h, --help           help for activate

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl user create

Description

Create a user.

Format

mmctl user create [flags]

Examples

user create --email user@example.com --username userexample --password Password1

Options

--email string       Required. The email address for the new user account
--firstname string   Optional. The first name for the new user account
-h, --help           help for create
--lastname string    Optional. The last name for the new user account
--locale string      Optional. The locale (ex: en, fr) for the new user account
--nickname string    Optional. The nickname for the new user account
--password string    Required. The password for the new user account
--system_admin       Optional. If supplied, the new user will be a system administrator. Defaults to false
--username string    Required. Username for the new user account

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl user deactivate

Description

Deactivate users. Deactivated users are immediately logged out of all sessions and are unable to log back in.

Format

mmctl user deactivate [emails, usernames, userIds] [flags]

Examples

user deactivate user@example.com
user deactivate username

Options

-h, --help       help for deactivate

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl user email

Description

Change the email address associated with a user.

Format

mmctl user email [user] [new email] [flags]

Examples

user email test user@example.com
user activate username

Options

-h, --help       help for email

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl user invite

Description

Send an email invite to a user, to join a team. You can invite a user to multiple teams by listing them. You can specify teams by name or ID.

Format

mmctl user invite [email] [teams] [flags]

Examples

user invite user@example.com myteam
user invite user@example.com myteam1 myteam2

Options

-h, --help       help for invite

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl user list

Description

List all users.

Format

mmctl user list [flags]

Examples

user list

Options

--all            Fetch all users. --page flag will be ignore if provided
-h, --help       help for list
--page int       Page number to fetch for the list of users
--per-page int   Number of users to be fetched (default 200)

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl user reset_password

Description

Send users an email to reset their password.

Format

mmctl user reset_password [users] [flags]

Examples

user reset_password user@example.com

Options

-h, --help       help for reset_password

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl user resetmfa

Description

Turn off multi-factor authentication for a user. If MFA enforcement is enabled, the user will be forced to re-enable MFA as soon as they login.

Format

mmctl user resetmfa [users] [flags]

Examples

user resetmfa user@example.com

Options

-h, --help       help for resetmfa

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl version

Description

Prints the version of mmctl.

Format

mmctl version [flags]

Options

-h, --help       help for version

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one

mmctl websocket

Description

Display websocket in a human-readable format.

Format

mmctl websocket [flags]

Options

-h, --help       help for websocket

Options inherited from parent commands

--format string               the format of the command output [plain, json] (default "plain")
--insecure-sha1-intermediate  allows the use of insecure TLS protocols, such as SHA-1
--strict                      will only run commands if the mmctl version matches the server one