# How To Create User in Mattermost with mmtcl?

**URL:** <https://forum.mattermost.com/t/how-to-create-user-in-mattermost-with-mmtcl/14544>\
**Category:** Troubleshooting\
**Created:** [November 29, 2022, 3:03pm UTC](https://forum.mattermost.com/t/how-to-create-user-in-mattermost-with-mmtcl/14544 "2022-11-29T15:03:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zahra](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@Zahra](https://forum.mattermost.com/u/Zahra)\
**Post date:** [November 29, 2022, 3:03pm UTC](https://forum.mattermost.com/t/how-to-create-user-in-mattermost-with-mmtcl/14544/1 "2022-11-29T15:03:30Z")

</div>

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

> [@Manual user creation?](https://forum.mattermost.com/t/manual-user-creation/14149/2):
>
> Hi mmix and welcome to the Mattermost forums! Unfortunately there’s really no “Create User” button in the system console - not sure why, but depending on the amount of users you need to create, you can either script your way through that with the mmctl command (that’s a command line client for Mattermost) or you can click on your team and get the invite link, which you can then open in a new browser to register with the e-mail address in question. It’s not necessary to validate the e-mail addre…

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [November 29, 2022, 3:49pm UTC](https://forum.mattermost.com/t/how-to-create-user-in-mattermost-with-mmtcl/14544/2 "2022-11-29T15:49:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jcabarcas](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@jcabarcas](https://forum.mattermost.com/u/jcabarcas)\
**Post date:** [December 1, 2023, 8:03pm UTC](https://forum.mattermost.com/t/how-to-create-user-in-mattermost-with-mmtcl/14544/3 "2023-12-01T20:03:52Z")

</div>

I enablelocalmode true after your suggestion restarted the server and still get an error

/opt/mattermost/bin/mmctl user create --email [jarvis.cabarcas@jhsmiami.org](mailto:jarvis.cabarcas@jhsmiami.org), --username jcabarcas --password cab-J00@ --system-admin --local  
Error: owner of the file “/var/tmp/mattermost\_local.socket” must be the same user running mmctl

---

<div class="post-metadata">

**Author:** ![john.oliver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/john.oliver/32/6436_2.png) [@john.oliver](https://forum.mattermost.com/u/john.oliver)\
**Post date:** [December 1, 2023, 11:04pm UTC](https://forum.mattermost.com/t/how-to-create-user-in-mattermost-with-mmtcl/14544/4 "2023-12-01T23:04:42Z")

</div>

What owner does

```auto
ls -l /var/tmp/mattermost_local.socket

```

reveal? What user are you running mmctl as?

You should be able to create a POSIX user group that contains the mattermost user and your user account and make it thr group owner of /var/tmp/mattermost\_local.socket

You can also

```auto
su -u mattermost_user mmctl...

```

---

<div class="post-metadata">

**Author:** ![jean](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jean](https://forum.mattermost.com/u/jean)\
**Post date:** [March 26, 2024, 2:21pm UTC](https://forum.mattermost.com/t/how-to-create-user-in-mattermost-with-mmtcl/14544/5 "2024-03-26T14:21:35Z")

</div>

still didn’t work. `sudo -u mattermost $(which mmctl) --local...` did the thing.
