How To Create User in Mattermost with mmtcl?

I Wanted to create user with mmctl command on local server Ubuntu 20.04.5 LTS with this command :

** /opt/mattermost/bin/mmctl user create --email s.chalian@… --username s.chalian --password 12345678 **

but gives me this error

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

Link of documentation that i,ve used for this

Hi Zahra and welcome to the Mattermost forums!

mmctl requires authentication, even if you’re on the same server as the Mattermost application server is running, but you can circumvent the username/password authentication by using local socket based authentication, which basically means that you can connect internally to the Mattermost server, without the extra need to authenticate yourself.
In order to do that, you would have to add the --local flag to mmctl and you will need to enable the local authentication mode and restart your Mattermost server for the changes to become active.
To enable local mode, open your Mattermost server’s config.json file and search for EnableLocalMode which most likely is set to false in your environment. Change it to true, restart the server and the mmctl command from above (with the additional --local flag added) should work now.

If you’re using a docker deployment, you will have to use the environment variable MM_SERVICESETTINGS_ENABLELOCALMODE instead of modifying the config.json directly.