# Cannot user create

**URL:** <https://forum.mattermost.com/t/cannot-user-create/16087>\
**Category:** Troubleshooting\
**Created:** [June 6, 2023, 3:38am UTC](https://forum.mattermost.com/t/cannot-user-create/16087 "2023-06-06T03:38:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![H.Furukawa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/h.furukawa/32/6899_2.png) [@H.Furukawa](https://forum.mattermost.com/u/H.Furukawa)\
**Post date:** [June 6, 2023, 3:38am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/1 "2023-06-06T03:38:44Z")

</div>

cannot create user, see below.  
I don’t know why the system say there is no command.

bin/mattermost user create --email user@example.test --username user --password Password  
Error: unknown command “user” for “mattermost”

---

<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:** [June 6, 2023, 3:56am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/2 "2023-06-06T03:56:49Z")

</div>

Hi @H.Furukawa and welcome to the Mattermost forums!

This command as an argument to the Mattermost binary is deprecated - please use the `mmctl` binary to create users on the command line.

---

<div class="post-metadata">

**Author:** ![H.Furukawa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/h.furukawa/32/6899_2.png) [@H.Furukawa](https://forum.mattermost.com/u/H.Furukawa)\
**Post date:** [June 6, 2023, 4:01am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/3 "2023-06-06T04:01:37Z")

</div>

Where can I install the mmctl from ?

---

<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:** [June 6, 2023, 4:13am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/4 "2023-06-06T04:13:49Z")

</div>

`mmctl` is part of the default installation and the binary is also installed in the `bin` folder, so you should be able to execute it with `bin/mmctl`. You need to set up authentication to your Mattermost server first using this tool, otherwise you won’t be able to run the commands. One way of doing that if you’re running `mmctl` directly on the server where Mattermost is hosted, is to use the `--local` mode of the `mmctl` application. To do that, you will have to change the configuration option `EnableLocalMode` in your server’s `config.json` to true and restart the server, afterwards, you can use `mmctl --local user [...]` to manipulate users without further authentication.

---

<div class="post-metadata">

**Author:** ![H.Furukawa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/h.furukawa/32/6899_2.png) [@H.Furukawa](https://forum.mattermost.com/u/H.Furukawa)\
**Post date:** [June 6, 2023, 4:30am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/5 "2023-06-06T04:30:02Z")

</div>

bin/mmctl is found. But the command errored “mmctl : command not found”.

```auto
$ cd /opt/mattermost/bin
$ ls
mattermost mmctl
$ mmctl --local user create ....
-bash: mmctl: command not found

```

Of course, before that, I set “EnableLocalMode=True” and rebooted.

---

<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:** [June 6, 2023, 5:17am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/6 "2023-06-06T05:17:47Z")

</div>

If you’re directly in the `bin` folder, you need to run `./mmctl` or you `cd` to `/opt/mattermost` and run `bin/mmctl` (like you did with the `mattermost` command earlier).

---

<div class="post-metadata">

**Author:** ![H.Furukawa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/h.furukawa/32/6899_2.png) [@H.Furukawa](https://forum.mattermost.com/u/H.Furukawa)\
**Post date:** [June 6, 2023, 5:23am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/7 "2023-06-06T05:23:29Z")

</div>

From the mmctl to the . /mmctl, I got the following

```auto
$ ./mmctl --local [user ....] 
Error: owner of the file "/var/tmp/mattermost_local.socket" must be the same user running mmctl

```

```auto
$ ls -l /var/tmp/mattermost_local.socket
srw-------. 1 mattermost mattermost 0 Jun 6 13:24 /var/tmp/mattermost_local.socket

```

---

<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:** [June 6, 2023, 5:37am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/8 "2023-06-06T05:37:20Z")

</div>

You can either change the permissions of the socket to include your linux user or group, or run `mmctl` either as `root` user or as the `mattermost` user.  
I suggest running it as user `mattermost`:

```auto
# interactive shell as mattermost user
su - mattermost
# (if this does not work, you can try the following command)
sudo -u mattermost -s

# run the mmctl binary as this user
/opt/mattermost/bin/mmctl --local ...

```

Alternatively, you can also use one-shot commands like:

```auto
su - mattermost -c /opt/mattermost/bin/mmctl ...
sudo -u mattermost /opt/mattermost/bin/mmctl ...

```

---

<div class="post-metadata">

**Author:** ![H.Furukawa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/h.furukawa/32/6899_2.png) [@H.Furukawa](https://forum.mattermost.com/u/H.Furukawa)\
**Post date:** [June 6, 2023, 5:45am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/9 "2023-06-06T05:45:25Z")

</div>

Thanks.

Your advice helped me do it.

```auto
sudo -u mattermost -s
/opt/mattermost/bin/mmctl --local [user...]

```

---

<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:** [June 6, 2023, 6:31am UTC](https://forum.mattermost.com/t/cannot-user-create/16087/10 "2023-06-06T06:31:40Z")

</div>

Awesome, thanks for the feedback!
