We're Hiring!

Mattermost Discussion Forums

Can't create new user with mmctl

Hello, after upgrading mattermost to version 6.1.0 I have a problem while trying to create new user using “mmctl user create” command.
I used to create new users with “mattermost user create”.
Now when I run this command

/opt/mattermost/bin/mmctl user create --email newusername@example.com --username newusername --password ‘newpassword’ --firstname User --lastname Test

I get the following error:

Error: cannot read user credentials, maybe you need to use login first: stat /root/.config/mmctl/config: no such file or directory

Mattermost is run by user mattermost. If I run “su mattermost” and then run the same mmctl command, I get:

Error: cannot read user credentials, maybe you need to use login first: stat /home/mattermost/.config/mmctl/config: no such file or directory

How can I solve this problem?
Do I have to change mattermost user’s home directory to /opt/mattermost/ or /opt/mattermost/bin/ ?

@mgdelacroix @streamer45 Would you be able to help take a look at this?

It appears that the expected config file is not found. Starting on version 6.0 mmctl is using $XDG_CONFIG_HOME/mmctl/config as default config file path. @isacikgoz is there any breaking to the config format or is it sufficient to either copy or pass the previous file through the --config-path command line option?

Hi, streamer45.
Thanks for responding!
I’ve managed to create new user by:

  1. enabling local mode by setting

“EnableLocalMode”: true

in /opt/mattermost/config/config.json
2) using the following command

./mmctl user create --local --email mail@example.com --username test1 --password ‘password’ --firstname username --lastname test --config /opt/mattermost/config/config.json

Hey @az-bp As far as I’m seeing you are using mattermost config file as mmctl config file. They are two different files. You can either set another file or let the tool create a config file to the default config directory. In your case the tool cannot find the XDG_CONFIG_HOME directory for both users. You should set an existing path to save your config file.